• Dojo DOM Functions
dojo/dom
This module provides some of basic DOM functions. These include:
• byId(id) – Find the single DOM node with the given id.
• isDescendant(node, ancestor) – Returns true if the node is a descendant of
ancestor.
dojo/dom-construct
• toDom(htmlString, document) – Builds a DOM tree from the HTML string and
returns the DOM that is the root of that tree.
• place(node, refNode, position)
◦ before
◦ after
◦ replace
◦ only
◦ first
◦ last
• create(tag, attrs, refNode, position)
• empty(node) – Delete all the children of the node.
• destroy(node) – Delete all the children of the node and the node itself.
dojo/query
The dojo/query module provides a powerful way to search for nodes within the DOM tree. The
module itself is a single function. The syntax for the function is:
query(selector, domTreeRoot)
where
• selector – A CSS selector pattern.
• domTreeRoot – An optional root in a DOM tree to start the search
The result from the query is a dojo NodeList object representing a list of nodes that match the
selector. Realize that the NodeList may be empty.
The selector is a String that describes the CSS pattern used to determine which nodes to return. The
pattern is passed to a "pattern matching engine" that interprets the pattern and scans the DOM tree
looking for matches. The patterns are:
Pattern Description
* Any element.
E Any element of type E.
E F An F element that is a descendant of an E element.
Page 143
Kommentare zu diesen Handbüchern