org.w3c.dom
Interface NodeSelector


public interface NodeSelector

The NodeSelector interface is implemented on the Document, DocumentFragment, and Element implementations for DOM implementations that support the Selectors API. This can be tested by passing in the feature string "Selectors-API" with version "1.0" to the DOMImplementation's hasFeature method.

This interface allows a quick and easy way to select a node or list of nodes using CSS selector syntax.

Since:
BlackBerry API 6.0.0

Method Summary
 Element querySelector(String selectors)
          Return the first Element in document order that matches the given selector or comma-separated selectors in the subtree rooted at this node.
 NodeList querySelectorAll(String selectors)
          Return all Elements, in document order, that match the given selector or comma-separated selectors in the subtree rooted at this node.
 



Method Detail

querySelector

Element querySelector(String selectors)
                      throws DOMException
Return the first Element in document order that matches the given selector or comma-separated selectors in the subtree rooted at this node.

Parameters:
selectors - The selector or selectors used to match elements. If null is passed in, the behavior is undefined.
Returns:
The first Element node that matches the selector(s), or null if no such node was found.
Throws:
DOMException - SYNTAX_ERR if the selector string is malformed, or a SECURITY_ERR if the implementation determines that processing the selector will result in a security violation. There are currently no known conditions under which this occurs. A NAMESPACE_ERR may also be thrown if the selector string uses a namespace prefix that cannot be resolved.
Since:
BlackBerry API 6.0.0

querySelectorAll

NodeList querySelectorAll(String selectors)
                          throws DOMException
Return all Elements, in document order, that match the given selector or comma-separated selectors in the subtree rooted at this node.

Parameters:
selectors - The selector or selectors used to match elements. If null is passed in, the behavior is undefined.
Returns:
A NodeList containing the Element nodes that matches the selector(s). This may be an empty NodeList if no such nodes were found. Note that the NodeList returned will not be "live"; it is a static list that will not reflect future changes to the DOM.
Throws:
DOMException - SYNTAX_ERR if the selector string is malformed, or a SECURITY_ERR if the implementation determines that processing the selector will result in a security violation. There are currently no known conditions under which this occurs. A NAMESPACE_ERR may also be thrown if the selector string uses a namespace prefix that cannot be resolved.
Since:
BlackBerry API 6.0.0





Copyright 1999-2010 Research In Motion Limited. 295 Phillip Street, Waterloo, Ontario, Canada, N2L 3W8. All Rights Reserved.
Copyright 1993-2003 Sun Microsystems, Inc. 901 San Antonio Road, Palo Alto, California, 94303, U.S.A. All Rights Reserved.
Copyright 2002-2003 Nokia Corporation All Rights Reserved.
Java is a trademark of Sun Microsystems, Inc.