YUI recommends YUI 3.

YUI 2 has been deprecated since 2011. This site acts as an archive for files and documentation.

YUI Library Home

YUI Library Examples: Dom Collection: Exploring the Dom Collection's API

Dom Collection: Exploring the Dom Collection's API

In this example, the use of several key Dom Collection methods is explored. Given the markup in the source section, you can invoke any of the methods by clicking on them; the Source is updated, as is its in-browser appearance (Render). In the Outupt section, you can review the elements that are selected or affected (or, in a few cases, the JavaScript return value) of the function you invoked.

Source

  1. <div id="demo">
  2. <ul id="demoList" class="parent">
  3. <li id="one" class="listItem">item 1</li>
  4. <li id="two" class="listItem">item 2</li>
  5. <li id="three" class="specialItem">item 3</li>
  6. </ul>
  7. </div>

Functions

Render

  • item 1
  • item 2
  • item 3

Output

Please select a function.

Configuration for This Example

You can load the necessary JavaScript and CSS for this example from Yahoo's servers. Click here to load the YUI Dependency Configurator with all of this example's dependencies preconfigured.

YUI Logger Output:

Logger Console

INFO 72ms (+2) 1:11:10 AM:

Dom

isAncestor([object HTMLHtmlElement],[object HTMLSpanElement] returning true

INFO 70ms (+24) 1:11:10 AM:

Dom

getElementsBy returning

INFO 46ms (+0) 1:11:09 AM:

Dom

generateId generating yui-log-filter-Dom09

WARN 46ms (+0) 1:11:09 AM:

Dom

batch called with invalid arguments

INFO 46ms (+0) 1:11:09 AM:

Dom

generateId generating yui-log-filter-LogReader08

WARN 46ms (+0) 1:11:09 AM:

Dom

batch called with invalid arguments

INFO 46ms (+0) 1:11:09 AM:

Dom

generateId generating yui-log-filter-Get07

WARN 46ms (+0) 1:11:09 AM:

Dom

batch called with invalid arguments

INFO 46ms (+0) 1:11:09 AM:

Dom

generateId generating yui-log-filter-global06

WARN 46ms (+0) 1:11:09 AM:

Dom

batch called with invalid arguments

INFO 46ms (+0) 1:11:09 AM:

Dom

generateId generating yui-log-filter-window05

WARN 46ms (+0) 1:11:09 AM:

Dom

batch called with invalid arguments

INFO 46ms (+0) 1:11:09 AM:

Dom

generateId generating yui-log-filter-time04

WARN 46ms (+1) 1:11:09 AM:

Dom

batch called with invalid arguments

INFO 45ms (+0) 1:11:09 AM:

Dom

generateId generating yui-log-filter-error03

WARN 45ms (+0) 1:11:09 AM:

Dom

batch called with invalid arguments

INFO 45ms (+0) 1:11:09 AM:

Dom

generateId generating yui-log-filter-warn02

WARN 45ms (+0) 1:11:09 AM:

Dom

batch called with invalid arguments

INFO 45ms (+0) 1:11:09 AM:

Dom

generateId generating yui-log-filter-info01

WARN 45ms (+0) 1:11:09 AM:

Dom

batch called with invalid arguments

INFO 45ms (+1) 1:11:09 AM:

Dom

generateId generating yui-log-hd00

INFO 44ms (+16) 1:11:09 AM:

LogReader instance0

LogReader initialized

INFO 28ms (+1) 1:11:09 AM:

Get

Appending node: ../../../2.x/build/event-mouseenter/event-mouseenter-min.js

INFO 27ms (+0) 1:11:09 AM:

Get

attempting to load ../../../2.x/build/event-mouseenter/event-mouseenter-min.js

INFO 27ms (+27) 1:11:09 AM:

Get

_next: q0, loaded: undefined

INFO 0ms (+0) 1:11:09 AM:

global

Logger initialized

Note: You are viewing this example in debug mode with logging enabled. This can significantly slow performance.

Reload with logging
and debugging disabled.

More Dom Collection Resources:

Copyright © 2011 Yahoo! Inc. All rights reserved.

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