YUI Library Home

Site Search (YDN & YUIBlog):

# YUI Library Examples: Dom Collection

# Dom Collection: Examples

The Dom Collection comprises a family of convenience methods that simplify common DOM-scripting tasks, including element positioning and CSS style management, while normalizing for cross-browser inconsistencies.

- Using setXY: Positioning elements relative to the document coordinate system can be quite a challenge. The Dom Utility provides this method to do it for you.
- Using getXY: Getting element positions relative to the document coordinate system can be quite a challenge. The Dom Utility provides this method to do it for you.
- Using setStyle: There are some differences between browsers regarding how style properties are set on HTMLElements. This method normalizes those for you.
- Using getStyle: There are some differences between browsers regarding how style properties are retrieved from HTMLElements. This method normalizes those for you.
- Using hasClass: This method allows you to test for the presence of a `className` on an HTMLElement.
- Using addClass: This method allows you to add a className to an HTMLElement.
- Using removeClass: This method allows you to remove a `className` from an HTMLElement.
- Using getElementsByClassName: This method allows you select all of the HTMLElements on a given page that share a specific `className`.
- Exploring the Dom Collection's API: The Dom Collection Explorer allows you to interact with some of the oft-used element-targeting functions in the YUI Dom Collection.

### Dom Collection:

- User's Guide (external)
- API Documentation
- Cheat Sheet PDF(external)

Copyright © 2009 Yahoo! Inc. All rights reserved.

Privacy Policy - Terms of Service - Copyright Policy - Job Openings