diff -r 000000000000 -r 40c8f766c9b8 src/cm/media/js/lib/yui/yui_3.0.0b1/examples/profiler/profiler-object-example.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/cm/media/js/lib/yui/yui_3.0.0b1/examples/profiler/profiler-object-example.html Mon Nov 23 15:14:29 2009 +0100 @@ -0,0 +1,226 @@ + + + + + YUI Library Examples: Profiler: Object Profiling Example + + + + + + + + + + + + + + +
+
+
+

+ + YUI 3.x Home - + +

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

YUI Library Examples: Profiler: Object Profiling Example

+
+
+ +

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

+ +
+
+
+
+ +

Profiler: Object Profiling Example

+ +
+

+

This example shows using the Profiler on all methods in an object. It uses the Y.DOM object +as the object to be profiled.

+ +
+
+ + + + +
div class="bar"
+
div class="bar-baz"
+
div class="bar "
+
div class=" bar "
+
div class=" bar baz"
+
div class=" bar2 baz"
+
div class="foo"
+
div class="foo" id="bar"
+
div class="foo bar baz"
+

p class="bar"

+ + + + + + +
+
+
+ +

Object Profiling Example

+

To illustrate using the Profiler on objects, the Y.DOM and Y.Node objects are registered for profiling. This means +that all of the methods on these objects are being profiled. To +illustrate their use, a number of demo elements are added to the markup:

+ +

The button is used to run the example. The function being called when the button is clicked is assigned by first + retrieving a Node instance for the button and then using the on method:

+ +

The function begins be registering Y.DOM and Y.Node with the Profiler. Note that since these objects don't + exist in the global scope, the second argument is necessary for registerObject(). Then, the Y.Node.all() + method is called to retrieve nodes for each element with a class of bar. The result of this operation is a NodeList + object, on which the addClass() method is called. After that, the full report is returned and the objects are unregistered. The last + step is to output all of the information that was collected. Even though there's only two methods called explicitly in this example, + the profiled data indicates that several other methods on Y.DOM and Y.Node were called internally to accomplish the + tasks.

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

Copyright © 2009 Yahoo! Inc. All rights reserved.

+

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

+
+
+ + + +