# Yahoo! UI Library

### dom 3.1.1

Yahoo! UI Library > dom > Selector
Search:
Filters Show Private Show Protected Show Deprecated

## `static` Class Selector

Provides support for using CSS selectors to query the DOM

### Properties

#### operators - `object`

List of operators and corresponding boolean functions. These functions are passed the attribute and the current node's value of the attribute.

#### PARENT_NODE - `object`

Provides helper methods for collecting and filtering DOM elements.

#### shorthand - `object`

Mapping of shorthand tokens to corresponding attribute selector

### Methods

#### _tokenize

`void _tokenize ( )`
Break selector into token units per simple selector. Combinator is attached to the previous token.

#### ancestor

`static HTMLElement ancestor ( element , selector , testSelf )`
A convenience function to emulate Y.Node's aNode.ancestor(selector).

Parameters:
  `element <HTMLElement>` An HTMLElement to start the query from.
  `selector <String>` The CSS selector to test the node against.
  `testSelf <Boolean>` optional Whether or not to include the element in the scan

Returns: `HTMLElement`
  The ancestor node matching the selector, or null.

#### query

`static Array query ( selector , root , firstOnly )`
Retrieves a set of nodes based on a given CSS selector.

Parameters:
  `selector <string>` The CSS Selector to test the node against.
  `root <HTMLElement>` optional An HTMLElement to start the query from. Defaults to Y.config.doc
  `firstOnly <Boolean>` optional Whether or not to return only the first match.

Returns: `Array`
  An array of nodes that match the given selector.

Copyright © 2010 Yahoo! Inc. All rights reserved.