ready-example-source.mustache revision 350964af8dfc6ab5df9d3fb0f274f7d018986c5b
<!-- include event dependencies -->
<div id="contentContainer">
<div id="demo"></div>
<!--a ul with an arbitrarily large number of children:-->
<ul>
{{#each readyItems}}
<li id='li-{{this}}'>child node #{{this}}</li>
{{/each}}
</ul>
</div>
<script>
YUI().use('*', function (Y) {
var results = Y.one('#demo');
//assign page load handler:
Y.on("load", function () {
results.append("<p>The window load event fired. The page and all of its image data, including the large image of Uluru, has completed loading.</p>");
}, Y.config.win);
//assign domready handler:
Y.on("domready", function () {
});
//assign 'contentready' handler:
Y.on("contentready", function () {
results.append("<p>The 'contentready' event fired for the element 'contentContainer'. That element and all of its children are present in the DOM.</p>");
}, "#contentContainer");
//assign 'available' handler:
Y.on("available", function () {
results.append("<p>The 'available' event fired on the element 'contentContainer'. That element is present in the DOM.</p>");
}, "#contentContainer");
results.append("<p>As the page loads, you'll see the 'available', 'contentready', 'domready', and window load events logged here as they fire in sequence.</p>");
});
</script>