class dom::Elem

sys::Obj
  dom::Elem

@Js

Source

Elem models a DOM element object.

See pod doc for details.

add

This add(Elem child)

Source

Add a new element as a child to this element. Return this.

addClassName

This addClassName(Str className)

Source

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

Source

Position and size of this widget relative to its parent, both measured in pixels.

checked

Bool? checked

Source

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()

Source

Get the child nodes of this element.

className

Str className

Source

The CSS class name(s) for this element.

enabled

Bool? enabled

Source

The enabled attribute for this element, or null if one not applicable. This is typically only valid for form elements.

find

Elem? find(|Elem->Bool| c)

Source

Return the first descendant for which c returns true. Return null if no element returns true.

findAll

Elem[] findAll(|Elem->Bool| c)

Source

Return a list of all descendants for which c returns true. Return an empty list if no element returns true.

first

Elem? first()

Source

Get the first child node of this element, or null if this element has no children.

focus

Void focus()

Source

Request keyboard focus on this elem.

get

@Operator
Obj? get(Str name, Obj? def := null)

Source

Get an attribute by name. If not found return the specificed default value.

hasClassName

Bool hasClassName(Str className)

Source

Return true if this element has the given CSS class name, or false if it does not.

html

Str html

Source

The HTML markup contained in this element.

id

Str id

Source

The id for this element.

name

Str name

Source

The name attribute for this element.

next

Elem? next()

Source

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)

Source

Attach an event handler to the given event on this element.

parent

Elem? parent()

Source

Get the parent Elem of this element, or null if this element has no parent.

pos

Point pos

Source

Position of element relative to its parent in pixels.

prev

Elem? prev()

Source

Get the previous sibling to this element, or null if this is the first element under its parent.

remove

This remove(Elem child)

Source

Remove a child element from this element. Return this.

removeClassName

This removeClassName(Str className)

Source

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)

Source

Set an attribute to the given value.

size

Size size

Source

Size of element in pixels.

tagName

Str tagName()

Source

Get the tag name for this element.

val

Obj? val

Source

The value attribute for this element, or null if one does not exist. This is typically only valid for form elements.