# Yahoo! UI Library

### dom 3.0.0

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.

#### inRegion

`Boolean inRegion ( all , altRegion )`
Check if any part of this node is in the passed region

Parameters:
  `all <Object} node2 The node to get the region from or an Object literal of the region $param {Boolean>` Should all of the node be inside the region
  `altRegion <Object>` An object literal containing the region for this node if we already have the data (for performance i.e. DragDrop)

Returns: `Boolean`
  True if in region, false if not.

#### intersect

`Object intersect ( element , element2 , altRegion )`
Find the intersect information for the passes nodes.

Parameters:
  `element <HTMLElement>` The first element
  `element2 <HTMLElement | Object>` The element or region to check the interect with
  `altRegion <Object>` An object literal containing the region for the first element if we already have the data (for performance i.e. DragDrop)

Returns: `Object`
  Object literal containing the following intersection data: (top, right, bottom, left, area, yoff, xoff, inRegion)

#### inViewportRegion

`Boolean inViewportRegion ( element , all , altRegion )`
Check if any part of this element is in the viewport

Parameters:
  `element <HTMLElement>` The DOM element.
  `all <Boolean>` Should all of the node be inside the region
  `altRegion <Object>` An object literal containing the region for this node if we already have the data (for performance i.e. DragDrop)

Returns: `Boolean`
  True if in region, false if not.

#### 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.

#### region

`Object region ( element )`
Returns an Object literal containing the following about this element: (top, right, bottom, left)

Parameters:
  `element <HTMLElement>` The DOM element.

Returns: `Object`
  Object literal containing the following about this element: (top, right, bottom, left)

#### viewportRegion

`Object viewportRegion ( )`
Returns an Object literal containing the following about the visible region of viewport: (top, right, bottom, left)

Returns: `Object`
  Object literal containing the following about the visible region of the viewport: (top, right, bottom, left)

Copyright © 2009 Yahoo! Inc. All rights reserved.