Fantom

 

class

dom::Elem

sys::Obj
  dom::Elem

@js

Elem models a DOM element object.

See docLib for details.

Slots

addSource

native This add(Elem child)

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

addClassNameSource

native 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

native 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

native Elem[] children()

Get the child nodes of this element.

classNameSource

native Str className

The CSS class name(s) for this element.

enabledSource

native Bool? enabled

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

findSource

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

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

findAllSource

native 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.

firstSource

native Elem? first()

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

focusSource

native Void focus()

Request keyboard focus on this elem.

getSource

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

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

hSource

native Int h()

The height of this element in pixels.

hasClassNameSource

native Bool hasClassName(Str className)

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

htmlSource

native Str html

The HTML markup contained in this element.

idSource

native Str id

The id for this element.

nameSource

native Str name

The name attribute for this element.

nextSource

native Elem? next()

Get the next sibling to this element, or null if this is the last element under its parent.

onEventSource

native Void onEvent(Str type, Bool useCapture, |Event| handler)

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

parentSource

native Elem? parent()

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

prevSource

native Elem? prev()

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

removeSource

native This remove(Elem child)

Remove a child element from this element. Return this.

removeClassNameSource

native 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

native Void set(Str name, Obj? val)

Set an attribute to the given value.

tagNameSource

native Str tagName()

Get the tag name for this element.

valSource

native Obj? val

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

wSource

native Int w()

The width of this element in pixels.

xSource

native Int x()

The x position relative to the parent element in pixels.

ySource

native Int y()

The y position relative to the parent element in pixels.