Version 1.3 glow.dom
API Quick Reference
JavaScript is required to use the quick reference
Accessing and manipulating the DOM
Further Info & Examples
Methods
- create
Returns a NodeList from an HTML fragment.
Synopsis
glow.dom.create(html);Parameters
- html
- Type
- String
An HTML string.
All top-level nodes must be elements (i.e. text content in the HTML must be wrapped in HTML tags).
Returns
Example
// NodeList of two elements var aNodes = glow.dom.create("<div>Hello</div><div> World</div>");- get
Returns a NodeList from CSS selectors and/or Elements.
Synopsis
glow.dom.get(nodespec+);Parameters
- nodespec+
- Type
- String | String[] | Element | Element[] | glow.dom.NodeList
One or more CSS selector strings, Elements or NodeLists.
Will also accept arrays of these types, or any combinations thereof.
Supported CSS selectors:
- Universal selector (* - all elements in the document tree).
- Type selector (div - tag name).
- Class selector (.myClass - class name).
- ID selector (#myDiv - ID).
- Child selector (\> - Child selector).
- Grouping (selector, selector, ...).
Returns
Example
// Nodelist with all links in element with id "nav" var aNodes = glow.dom.get("#nav a");// NodeList containing the nodes passed in var aNodes2 = glow.dom.get(someNode, anotherNode);// NodeList containing elements in the first form var aNodes3 = glow.dom.get(document.forms[0].elements);- parseCssColor
Returns an object representing a CSS colour string.
Synopsis
glow.dom.parseCssColor(color);Parameters
- color
- Type
- String
A CSS colour.
Examples of valid values are "red", "#f00", "#ff0000", "rgb(255,0,0)", "rgb(100%, 0%, 0%)"
Returns
An object with properties named "r", "g" and "b", each will have an integer value between 0 and 255.
Example
glow.dom.parseCssColor("#ff0000"); // returns {r:255, g:0, b:0}
Classes
- NodeList
An array-like collection of DOM Elements.