querySelectorAll()

Searches the DOM for matching elements.

Elements are returned in document order.

Syntax

var element = behavior.querySelectorAll([node, ] selector);

If you only supply one argument then that argument is the selector and the document is used as the context node for the search.

Example

var menu = jsb.behavior.extend({
  onattach: function(element) {
    this.querySelectorAll(element, "> li").forEach(menuitem.attach);
  }
});

Notes

This method provides a cross-browser, safe way to perform the W3C equivalent method. Please note that some browsers do not support this method so you should always use the jsb method.

This method returns a base2.dom.StaticNodeList object which implements additional methods for enumeration.

See Also