JavaScript (YUI2 and YUI3) skeleton code

YUI2

// assuming we've already included this library:
// http://yui.yahooapis.com/combo?2.8.1/build/yahoo-dom-event/yahoo-dom-event.js
// and that this script is run after all DOM markup required by the code
(function () {
    var Y = YAHOO,
        YU = Y.util;
    YU.Event.onDOMReady(function () {
        // This function will be executed as a callback once the DOM is completely ready
    });
})();

YUI3

YUI().use('*', function (Y) {
    Y.on("domready", function () {
        // the DOM is now fully available
    }, Y);
});


About this entry