´óÏó´«Ã½

Please turn on JavaScript. To find out how to do this visit the .

Accessing and manipulating the DOM

Methods

create

Returns a NodeList from an HTML fragment.

Synopsis

glow.dom.create(html, opts);

Parameters

html
Type

An HTML string.

All top-level nodes must be elements (i.e. text content in the HTML must be wrapped in HTML tags).

opts
Type
Optional
Yes

An optional options object

escapeHtml

Escape HTML in the interpolate data object.

Type
Optional
Yes
interpolate

Data for a call to glow.lang.interpolate

Type
Optional
Yes

If this option is set, the String html parameter will be passed through glow.lang.interpolate with this as the data and no options If glow.lang.interpolates options are required, an explicit call must be made

Returns

Example

// NodeList of two elements
var myNodeList = glow.dom.create("<div>Hello</div><div>World</div>");
// Nodelist of one list item
var listItem = glow.dom.create('<li>{content}</li>', {
  interpolate: {content: textFromUser},
  escapeHtml: true
});
// if testFromUser contains HTML, it will be correctly escaped
// before being inserted into the li
get

Returns a NodeList from CSS selectors and/or Elements.

Synopsis

glow.dom.get(nodespec+);

Parameters

nodespec+
Type
| | | | 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 "*".
  • Type selector "div"
  • Class selector ".myClass"
  • ID selector "#myDiv"
  • Child selector "ul > li"
  • Grouping "div, p"

Returns

Example

// Nodelist with all links in element with id "nav"
var myNodeList = glow.dom.get("#nav a");
// NodeList containing the nodes passed in
var myNodeList = glow.dom.get(someNode, anotherNode);
// NodeList containing elements in the first form
var myNodeList = glow.dom.get(document.forms[0].elements);
parseCssColor

Returns an object representing a CSS colour string.

Synopsis

glow.dom.parseCssColor(color);

Parameters

color
Type

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.

Documentation generated by 2.1.0 on Thu Jul 07 2011 12:47:27 GMT+0100 (BST)

´óÏó´«Ã½ iD

´óÏó´«Ã½ navigation

´óÏó´«Ã½ © 2014 The ´óÏó´«Ã½ is not responsible for the content of external sites. Read more.

This page is best viewed in an up-to-date web browser with style sheets (CSS) enabled. While you will be able to view the content of this page in your current browser, you will not be able to get the full visual experience. Please consider upgrading your browser software or enabling style sheets (CSS) if you are able to do so.