The Query Namespace

Cross-browser implementation of querySelector/querySelectorAll.

Summary
The Query NamespaceCross-browser implementation of querySelector/querySelectorAll.
Version1.0
ElementThese functions are bound to elements.
Properties
querySelectorAllMatch elements by CSS query
querySelectorMatch a single element by CSS query

Version

1.0

License

Requires

Flow.js.

Element

These functions are bound to elements.

Summary
Properties
querySelectorAllMatch elements by CSS query
querySelectorMatch a single element by CSS query

Properties

querySelectorAll

Match elements by CSS query

Shorthand

queryAll

Parameters

querythe query to match.

Example

var foo = document.querySelectorAll("div ul.foo"); // Matches all ul's with a class of "foo"
foo = document.queryAll("div ul.foo li"); // Shortcut. Returns all "li"s in foo.

querySelector

Match a single element by CSS query

Shorthand

query

Parameters

querythe query to match.

Example

var foo = document.querySelector("div ul.foo"); // Returns the first ul.foo.
foo = document.query("div ul.foo li"); // Shortcut. Returns the first "li" in foo.