Javascript Reference
Categories: TreeWalker

javascript TreeWalker firstChild( ), lastChild( ), nextSibling( ), parentNode( ), previousSibling( )

@March 15, 2008, 1:22 a.m.
firstChild( ), lastChild( ), nextSibling( ), parentNode( ), previousSibling( )Firefox/Netscape/NN 7 IE n/a Chrome/Safari/DOM 2  


These methods return references to nodes within the hierarchy of items in the TreeWalker object. The parent-descendant relationships between nodes are identical to those of the nodes within the document tree. As you invoke any one of these methods, the TreeWalker's internal pointer moves to a position adjacent to the node's spot within the TreeWalker list. If there is no node meeting the desired reference, the method returns null. This means that you need to verify the existence of the node before reading any property of the node:

if (myTreeWalker.nextSibling( )) {
    var theTag = myTreeWalker.currentNode.tagName;

If you reference a property of a null reference directly (myTreeWalker.nextSibling( ).tagName, for example), a reference error results.



Returned Value

Reference to a document tree node.

cheap atorvastatin 80mg <a href="">buy atorvastatin 40mg pills</a> generic atorvastatin 40mg
Rywjie - 4 months
buy generic atorvastatin over the counter <a href="">brand atorvastatin 80mg</a> order atorvastatin 10mg sale
Plsihe - 4 months

Powered by Linode.