class dom::Elem
sys::Obj dom::Elem
@Js
Elem models a DOM element object.
See pod doc for details.
- add
-
Add a new element as a child to this element. Return this.
- addClassName
-
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.
- bounds
-
Rect bounds
Position and size of this widget relative to its parent, both measured in pixels.
- checked
-
Bool? checked
The checked attribute for this element, or null if one does not exist. This is typically only valid for some form elements.
- children
-
Elem[] children()
Get the child nodes of this element.
- className
-
Str className
The CSS class name(s) for this element.
- enabled
-
Bool? enabled
The enabled attribute for this element, or null if one not applicable. This is typically only valid for form elements.
- find
-
Return the first descendant for which c returns true. Return null if no element returns true.
- findAll
-
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.
- first
-
Elem? first()
Get the first child node of this element, or null if this element has no children.
- focus
-
Void focus()
Request keyboard focus on this elem.
- get
-
@Operator
Obj? get(Str name, Obj? def := null)Get an attribute by name. If not found return the specificed default value.
- hasClassName
-
Bool hasClassName(Str className)
Return true if this element has the given CSS class name, or false if it does not.
- html
-
Str html
The HTML markup contained in this element.
- id
-
Str id
The id for this element.
- name
-
Str name
The name attribute for this element.
- next
-
Elem? next()
Get the next sibling to this element, or null if this is the last element under its parent.
- onEvent
-
Void onEvent(Str type, Bool useCapture, |DomEvent| handler)
Attach an event handler to the given event on this element.
- parent
-
Elem? parent()
Get the parent Elem of this element, or null if this element has no parent.
- pos
-
Point pos
Position of element relative to its parent in pixels.
- prev
-
Elem? prev()
Get the previous sibling to this element, or null if this is the first element under its parent.
- remove
-
Remove a child element from this element. Return this.
- removeClassName
-
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.
- set
-
@Operator
Void set(Str name, Obj? val)Set an attribute to the given value.
- size
-
Size size
Size of element in pixels.
- tagName
-
Str tagName()
Get the tag name for this element.
- val
-
Obj? val
The value attribute for this element, or null if one does not exist. This is typically only valid for form elements.