up.element
JavaScript namespace
Low-level functions to access and change the DOM.
up.element.get() and up.element.subtree() look up elements. up.element.createFromHTML() and up.element.createFromSelector() build elements, and up.element.affix() builds one and attaches it to a parent. Functions like up.element.attr(), up.element.numberAttr() and up.element.jsonAttr() parse attribute values into typed values, and up.element.toggle() or up.element.hide() change visibility through the [hidden] attribute.
These functions know nothing about layers or animation. For a fragment-aware API, prefer up.fragment.
Features
-
Elements with this attribute are hidden from the page.
-
Creates an element matching the given CSS selector and attaches it to the given parent element.
-
Returns all descendant elements matching the given selector.
-
Returns the given
attributevalue for the givenelement. -
Returns the value of the given attribute on the given element, cast as a boolean value.
-
Returns the first element that matches the selector by testing the element itself and traversing up through its ancestors in the DOM tree.
-
Parses an element from the given HTML fragment string.
-
Creates an element matching the given CSS selector.
-
Parses a list of nodes from a string of HTML.
-
Returns the first descendant element matching the given selector.
-
Returns the native Element for the given value.
-
Hides the given element.
-
Returns whether the given element is attached to the DOM tree.
-
Returns whether the given element has been removed from the DOM tree.
-
Returns whether the given element has no content.
-
Returns whether the given element is currently visible.
-
Reads the given attribute from the element, parsed as relaxed JSON.
-
Returns whether the given element matches the given CSS selector.
-
Returns the value of the given attribute on the given element, cast to a number.
-
Removes the given element from the DOM tree.
-
Replaces the given old element with the given new element.
-
Sets properties from the given object as attributes on the given element.
-
Sets the given CSS properties as inline styles on the given element.
-
Shows the given element.
-
Returns computed CSS styles for the given element.
-
Returns a computed CSS property value for the given element, cast as a number.
-
Returns a list of a
rootelement's descendants matching the given selector. -
Changes whether the given element is shown or hidden.
-
Adds or removes the given class from the given element.
-
Returns a CSS selector that matches the given element as good as possible.