diff -r 000000000000 -r 40c8f766c9b8 src/cm/media/js/lib/yui/yui_3.0.0b1/examples/node/event-node.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/cm/media/js/lib/yui/yui_3.0.0b1/examples/node/event-node.html Mon Nov 23 15:14:29 2009 +0100 @@ -0,0 +1,186 @@ + + + + + YUI Library Examples: Node: NodeList Events + + + + + + + + + + + + +
+
+
+

+ + YUI 3.x Home - + +

+
+ + +
+ + + +
+
+
+
+

YUI Library Examples: Node: NodeList Events

+
+
+ +

Note: This is YUI 3.x. Looking for YUI 2.x?

+ +
+
+
+
+ +

Node: NodeList Events

+ +
+

+

This example demonstrates how to use events with NodeList instances.

+

Clicking a box will update its content.

+

+ +
+
+ + + + +
    +
  • i am lorem

  • +
  • i am ispum

  • +
+ + + + + + + +
+
+
+ +

Setting up the NodeList

+

First we need some HTML to work with.

+ +

Handling Events

+

Next we will add a handler to run when the event is fired. In our handler we will update the node with the type of the event.

+

Note that the event handler receives an event object with its currentTarget set to the current Node instance, and the actual node clicked as the target. The context of the handler is the NodeList instance, so this refers to our NodeList instance.

+ + +

Attaching Events

+

We can assign our handler to all of the items by using the all method to get a NodeList instance and using the on method to subscribe to the event.

+ + +

Full Script Source

+ +
+ +
+ +
+
+ + + +
+ +
+

Copyright © 2009 Yahoo! Inc. All rights reserved.

+

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

+
+
+ + + +