Elem models a DOM element object.
Slots
- addSource
-
Add a new element as a child to this element. Return this.
- addClassNameSource
-
This addClassName(Str className)
Add the given CSS class name to this element. If this element already contains the given class name, then this method does nothing. Returns this.
- checkedSource
-
Bool? checked
The checked attribute for this element, or null if one does not exist. This is typically only valid for some form elements.
- childrenSource
-
Elem[] children()
Get the child nodes of this element.
- classNameSource
-
Str className
The CSS class name(s) for this element.
- findSource
-
Return the first descendant for which c returns true. Return null if no element returns true.
- findAllSource
-
Elem[] findAll(|Elem -> Bool| c)
Return a list of all descendants for which c returns true. Return an empty list if no element returns true.
- focusSource
-
Void focus()
Request keyboard focus on this elem.
- getSource
-
Obj? get(Str name, Obj? def := null)
Get an attribute by name. If not found return the specificed default value.
- hSource
-
Int h()
The height of this element in pixels.
- hasClassNameSource
-
Bool hasClassName(Str className)
Return true if this element has the given CSS class name, or false if it does not.
- htmlSource
-
Str html
The HTML markup contained in this element.
- idSource
-
Str id
The id for this element.
- makeSource
-
new make(Obj obj)
- nameSource
-
Str name
The name attribute for this element.
- nextSource
-
Elem? next()
Get the next sibling to this element, or null if this is the last element under its parent.
- onEventSource
-
Void onEvent(Str type, Bool useCapture, |Event| handler)
Attach an event handler to the given event on this element.
- parentSource
-
Elem? parent()
Get the parent Elem of this element, or null if this element has no parent.
- prevSource
-
Elem? prev()
Get the previous sibling to this element, or null if this is the first element under its parent.
- removeSource
-
Remove a child element from this element. Return this.
- removeClassNameSource
-
This removeClassName(Str className)
Remove the given CSS class name to this element. If this element does not have the given class name, this method does nothing. Returns this.
- setSource
-
Set an attribute to the given value.
- styleSource
-
Obj style()
Get the style object for this element.
- tagNameSource
-
Str tagName()
Get the tag name for this element.
- valueSource
-
Obj? value
The value attribute for this element, or null if one does not exist. This is typically only valid for form elements.
- wSource
-
Int w()
The width of this element in pixels.
- xSource
-
Int x()
The x position relative to the parent element in pixels.
- ySource
-
Int y()
The y position relative to the parent element in pixels.