A unified interface for DOM elements used by Substance.
There are three different implementations of this interface:
Methods which rely on a CSS selector implementation are only available for ui/DefaultDOMElement instance, which is used during DOM import. I.e., don't use the following methods in Component renderers:
the native element |
Checks if a CSS class is set.
className | String |
Boolean | true if the CSS class is set |
Adds a CSS class.
classString | String | A space-separated string with CSS classes |
this |
Removes a CSS class.
classString | String | A space-separated string with CSS classes |
this |
jQuery style getter and setter for attributes.
name | String | |
[value] | String | if present the attribute will be set |
String|this | if used as getter the attribute value, otherwise this element for chaining |
Removes an attribute.
name | String |
this |
Get the attribute with a given name.
String | the attribute's value. |
Set the attribute with a given name.
the | String | attribute's value. |
this |
jQuery style getter and setter for HTML element properties.
name | String | |
[value] | String | if present the property will be set |
String|this | if used as getter the property value, otherwise this element for chaining |
Get the tagName of this element.
String | the tag name in lower-case. |
Set the tagName of this element.
tagName | String | the new tag name |
this |
Set the id of this element.
id | String | the new id |
this |
jQuery style getter and setter for the value of an element.
[value] | String | The value to set. |
String|this | the value if used as a getter, |
jQuery style method to set or get inline CSS styles.
name | String | the style name |
[value] | String | the style value |
String|this | the style value or this if used as a setter |
Gets or sets the text content of an element.
[text] | String | The text content to set. |
String|this | The text content if used as a getter, |
Get the textContent of this element.
String |
Set the textContent of this element.
text | String | the new text content |
this |
jQuery style getter and setter for the innerHTML of an element.
[html] | String | The html to set. |
String|this | the inner html if used as a getter, |
Get the innerHTML of this element.
String |
Set the innerHTML of this element.
text | String | the new text content |
this |
Get the outerHTML of this element.
String |
Registers an Element event handler.
event | String | The event name. |
handler | Function | The handler function. |
[context] | Object | context where the function should be bound to |
[options] | Object | |
[options.selector] | Object | for event delegation |
[options.capture] | Object | to register the event in the event's capture phase (bubbling top-down) |
this |
Unregisters the handler of a given event.
event | String | The event name. |
this |
Gets the type of this element in lower-case.
String |
Get child nodes of this element.
This method provides a new array with wrapped native elements. Better use getChildAt().
Array. |
Get child elements of this element.
This method provides a new array with wrapped native elements. Better use getChildAt().
Array. |
Checks if the element is a TextNode.
Boolean | true if the element is of type |
Checks if the element is actually an element as opposed to a node.
Boolean | true if the element is of type |
Checks if the element is a CommentNode.
Boolean | true if the element is of type |
Checks if the element is a DocumentNode.
Boolean | true if the element is of type |
Creates a clone of the current element.
ui/DOMElement | A clone of this element. |
Creates a DOMElement.
Checks if a given CSS selector matches for this element.
Attention This method is currently not implemented for {ui/VirtualElement}. This means you should use it only in importer implementations.
cssSelector | String |
Boolean |
Get the parent element of this element.
ui/DOMElement | the parent element |
Get the root ancestor element of this element.
In the browser this is the window.document
.
ui/DOMElement | the root element |
Find the first descendant element matching the given CSS selector. Note this differs from jQuery.find() that it returns only one element.
Attention This method is currently not implemented for {ui/VirtualElement}. This means you can use it only in importer implementations, but not in render or exporter implementations.
Find all descendant elements matching the given CSS selector.
Attention This method is currently not implemented for {ui/VirtualElement}. This means you can use it only in importer implementations, but not in render or exporter implementations.
cssSelector | String |
Array. | found elements |
Append a child element.
child | DOMElement|String | An element or text to append |
this |
Insert a child element at a given position.
pos | Number | insert position |
child | DOMElement|String | The child element or text to insert. |
this |
Remove the child at a given position.
pos | Number |
this |
Removes this element from its parent.
this |
Removes all child nodes from this element.
this |
Focusses this element.
Attention: this makes only sense for elements which are rendered in the browser
Blur this element.
Trigger a click event on this element.
Outer height as provided by $.outerHeight(withMargin)
Offset values as provided by $.offset()
Position values as provided by $.position()
Get element factory conveniently
var $$ = el.getElementFactory() $$('div').append('bla')