|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
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.
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 Element s, in document order, that match the
given selector or comma-separated selectors in the subtree rooted at this
node. |
Method Detail |
---|
Element querySelector(String selectors) throws DOMException
Element
in document order that matches the
given selector or comma-separated selectors in the subtree rooted at this
node.
selectors
- The selector or selectors used to match elements. If
null
is passed in, the behavior is undefined.
Element
node that matches the selector(s),
or null
if no such node was found.
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.NodeList querySelectorAll(String selectors) throws DOMException
Element
s, in document order, that match the
given selector or comma-separated selectors in the subtree rooted at this
node.
selectors
- The selector or selectors used to match elements. If
null
is passed in, the behavior is undefined.
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.
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.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Copyright 1999-2011 Research In Motion Limited. 295 Phillip Street, Waterloo, Ontario, Canada, N2L 3W8. All Rights Reserved.
Java is a trademark of Oracle America Inc. in the US and other countries.
Legal