dom.html revision f699a6a8ba96e55770b2434f4b2299c8d1a83b32
0d6d1a2d994933a68a100ec3dcdc7c7a0eeeae6cJenny Han Donnelly<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
8392a541bf432ed8d6e1985b6306b83dc898768dJenny Han Donnelly<html debug="true">
0d6d1a2d994933a68a100ec3dcdc7c7a0eeeae6cJenny Han Donnelly<head>
0d6d1a2d994933a68a100ec3dcdc7c7a0eeeae6cJenny Han Donnelly<title>YUI 3.0</title>
2390f77db0b974f19412b6ee655c3983bfcaa812Satyen Desai<script type="text/javascript" src="/build/yui/yui-debug.js"></script>
0d6d1a2d994933a68a100ec3dcdc7c7a0eeeae6cJenny Han Donnelly<script type="text/javascript" src="/build/oop/oop-debug.js"></script>
0d6d1a2d994933a68a100ec3dcdc7c7a0eeeae6cJenny Han Donnelly<script type="text/javascript" src="/build/event-custom/event-custom.js"></script>
0d6d1a2d994933a68a100ec3dcdc7c7a0eeeae6cJenny Han Donnelly<script type="text/javascript" src="/build/event/event-debug.js"></script>
0d6d1a2d994933a68a100ec3dcdc7c7a0eeeae6cJenny Han Donnelly<script type="text/javascript" src="/build/event-simulate/event-simulate.js"></script>
8392a541bf432ed8d6e1985b6306b83dc898768dJenny Han Donnelly<script type="text/javascript" src="/build/dom/dom.js"></script>
8392a541bf432ed8d6e1985b6306b83dc898768dJenny Han Donnelly<script type="text/javascript" src="/build/node/node.js"></script>
8392a541bf432ed8d6e1985b6306b83dc898768dJenny Han Donnelly<script type="text/javascript" src="/build/dump/dump.js"></script>
0d6d1a2d994933a68a100ec3dcdc7c7a0eeeae6cJenny Han Donnelly<script type="text/javascript" src="/build/substitute/substitute.js"></script>
0d6d1a2d994933a68a100ec3dcdc7c7a0eeeae6cJenny Han Donnelly
8392a541bf432ed8d6e1985b6306b83dc898768dJenny Han Donnelly<body>
b9436848b51ee2b4f04b9217e74172c5a05ce276Jenny Han Donnelly
8392a541bf432ed8d6e1985b6306b83dc898768dJenny Han Donnelly<div id="body">asdf</div>
8392a541bf432ed8d6e1985b6306b83dc898768dJenny Han Donnelly
8392a541bf432ed8d6e1985b6306b83dc898768dJenny Han Donnelly<form id="form1" name="form1">
8392a541bf432ed8d6e1985b6306b83dc898768dJenny Han Donnelly
8392a541bf432ed8d6e1985b6306b83dc898768dJenny Han Donnelly<input id="button1" type="button" value="Button 1" class="button" />
8392a541bf432ed8d6e1985b6306b83dc898768dJenny Han Donnelly<input id="button2" type="button" value="Button 2" class="button" />
8392a541bf432ed8d6e1985b6306b83dc898768dJenny Han Donnelly<input id="text1" type="text" value="something" class="nothing" />
8392a541bf432ed8d6e1985b6306b83dc898768dJenny Han Donnelly
8392a541bf432ed8d6e1985b6306b83dc898768dJenny Han Donnelly</form>
8392a541bf432ed8d6e1985b6306b83dc898768dJenny Han Donnelly
8392a541bf432ed8d6e1985b6306b83dc898768dJenny Han Donnelly<script>
8392a541bf432ed8d6e1985b6306b83dc898768dJenny Han Donnelly
8392a541bf432ed8d6e1985b6306b83dc898768dJenny Han Donnellyif (typeof loadFirebugConsole == 'function') {
8392a541bf432ed8d6e1985b6306b83dc898768dJenny Han Donnelly loadFirebugConsole();
8392a541bf432ed8d6e1985b6306b83dc898768dJenny Han Donnelly}
d3ac39f387c773c28001a1323aa85082051965aemattsnider
8392a541bf432ed8d6e1985b6306b83dc898768dJenny Han DonnellyYUI({
0d6d1a2d994933a68a100ec3dcdc7c7a0eeeae6cJenny Han Donnelly
d3ac39f387c773c28001a1323aa85082051965aemattsnider base: '/build/'
8392a541bf432ed8d6e1985b6306b83dc898768dJenny Han Donnelly
8392a541bf432ed8d6e1985b6306b83dc898768dJenny Han Donnelly}).use('node', 'dump', 'substitute', function(Y) {
8392a541bf432ed8d6e1985b6306b83dc898768dJenny Han Donnelly
8392a541bf432ed8d6e1985b6306b83dc898768dJenny Han Donnelly Y.on('load', function(e) {
8392a541bf432ed8d6e1985b6306b83dc898768dJenny Han Donnelly Y.log('window load event');
8392a541bf432ed8d6e1985b6306b83dc898768dJenny Han Donnelly });
8392a541bf432ed8d6e1985b6306b83dc898768dJenny Han Donnelly
8392a541bf432ed8d6e1985b6306b83dc898768dJenny Han Donnelly // debugger;
8392a541bf432ed8d6e1985b6306b83dc898768dJenny Han Donnelly
8392a541bf432ed8d6e1985b6306b83dc898768dJenny Han Donnelly // alert('starting JS');
0d6d1a2d994933a68a100ec3dcdc7c7a0eeeae6cJenny Han Donnelly
8392a541bf432ed8d6e1985b6306b83dc898768dJenny Han Donnelly Y.log('asdf');
8392a541bf432ed8d6e1985b6306b83dc898768dJenny Han Donnelly
0d6d1a2d994933a68a100ec3dcdc7c7a0eeeae6cJenny Han Donnelly
8392a541bf432ed8d6e1985b6306b83dc898768dJenny Han Donnelly Y.on('event:ready', function() {
8392a541bf432ed8d6e1985b6306b83dc898768dJenny Han Donnelly Y.log('event:ready SUBSCRIBER');
8392a541bf432ed8d6e1985b6306b83dc898768dJenny Han Donnelly });
8392a541bf432ed8d6e1985b6306b83dc898768dJenny Han Donnelly
8392a541bf432ed8d6e1985b6306b83dc898768dJenny Han Donnelly Y.on('domready', function() {
8392a541bf432ed8d6e1985b6306b83dc898768dJenny Han Donnelly Y.log('domready SUBSCRIBER');
8392a541bf432ed8d6e1985b6306b83dc898768dJenny Han Donnelly });
8392a541bf432ed8d6e1985b6306b83dc898768dJenny Han Donnelly
8392a541bf432ed8d6e1985b6306b83dc898768dJenny Han Donnelly /*
8392a541bf432ed8d6e1985b6306b83dc898768dJenny Han Donnelly
8392a541bf432ed8d6e1985b6306b83dc898768dJenny Han Donnelly Y.on('click', function(e, arg1, arg2) {
8392a541bf432ed8d6e1985b6306b83dc898768dJenny Han Donnelly
8392a541bf432ed8d6e1985b6306b83dc898768dJenny Han Donnelly this.setStyle('background-color', 'red');
8392a541bf432ed8d6e1985b6306b83dc898768dJenny Han Donnelly
0d6d1a2d994933a68a100ec3dcdc7c7a0eeeae6cJenny Han Donnelly Y.log('document click' + this);
8392a541bf432ed8d6e1985b6306b83dc898768dJenny Han Donnelly Y.log(Y.Array(arguments));
d3ac39f387c773c28001a1323aa85082051965aemattsnider
d3ac39f387c773c28001a1323aa85082051965aemattsnider }, document);
d3ac39f387c773c28001a1323aa85082051965aemattsnider */
8392a541bf432ed8d6e1985b6306b83dc898768dJenny Han Donnelly
3f8c8f56d68f749e363b10328b2a5c97a5c96863Jenny Donnelly // Y.on('yui:log', function(msg) {
d3ac39f387c773c28001a1323aa85082051965aemattsnider // var d=document, b=d.body, n=d.createElement("div");
d3ac39f387c773c28001a1323aa85082051965aemattsnider // if (b) {
d3ac39f387c773c28001a1323aa85082051965aemattsnider // n.appendChild(d.createTextNode(msg));
d3ac39f387c773c28001a1323aa85082051965aemattsnider // b.appendChild(n);
d3ac39f387c773c28001a1323aa85082051965aemattsnider // }
d3ac39f387c773c28001a1323aa85082051965aemattsnider
d3ac39f387c773c28001a1323aa85082051965aemattsnider // });
d3ac39f387c773c28001a1323aa85082051965aemattsnider
d3ac39f387c773c28001a1323aa85082051965aemattsnider/*
d3ac39f387c773c28001a1323aa85082051965aemattsnider Y.on('event:ready', function() {
d3ac39f387c773c28001a1323aa85082051965aemattsnider Y.log("onDOMReady fired");
d3ac39f387c773c28001a1323aa85082051965aemattsnider });
d3ac39f387c773c28001a1323aa85082051965aemattsnider */
d3ac39f387c773c28001a1323aa85082051965aemattsnider
d3ac39f387c773c28001a1323aa85082051965aemattsnider
d3ac39f387c773c28001a1323aa85082051965aemattsnider/*
d3ac39f387c773c28001a1323aa85082051965aemattsnider
d3ac39f387c773c28001a1323aa85082051965aemattsnider document.getElementById('form1').addEventListener('focus',
d3ac39f387c773c28001a1323aa85082051965aemattsnider function(e) {
d3ac39f387c773c28001a1323aa85082051965aemattsnider Y.log('bubble phase focus');
d3ac39f387c773c28001a1323aa85082051965aemattsnider e.stopPropagation();
d3ac39f387c773c28001a1323aa85082051965aemattsnider }, false);
d3ac39f387c773c28001a1323aa85082051965aemattsnider */
d3ac39f387c773c28001a1323aa85082051965aemattsnider
d3ac39f387c773c28001a1323aa85082051965aemattsnider
d3ac39f387c773c28001a1323aa85082051965aemattsnider Y.on('focus', function() {
d3ac39f387c773c28001a1323aa85082051965aemattsnider Y.log("focus fired");
d3ac39f387c773c28001a1323aa85082051965aemattsnider }, '#form1');
d3ac39f387c773c28001a1323aa85082051965aemattsnider
d3ac39f387c773c28001a1323aa85082051965aemattsnider Y.on('blur', function() {
d3ac39f387c773c28001a1323aa85082051965aemattsnider Y.log("blur fired");
d3ac39f387c773c28001a1323aa85082051965aemattsnider }, '#form1');
d3ac39f387c773c28001a1323aa85082051965aemattsnider
d3ac39f387c773c28001a1323aa85082051965aemattsnider /*
d3ac39f387c773c28001a1323aa85082051965aemattsnider
d3ac39f387c773c28001a1323aa85082051965aemattsnider document.getElementById('text1').addEventListener('focus',
d3ac39f387c773c28001a1323aa85082051965aemattsnider function(e) {
d3ac39f387c773c28001a1323aa85082051965aemattsnider Y.log('capture phase focus');
d3ac39f387c773c28001a1323aa85082051965aemattsnider e.stopPropagation();
d3ac39f387c773c28001a1323aa85082051965aemattsnider }, true);
d3ac39f387c773c28001a1323aa85082051965aemattsnider */
d3ac39f387c773c28001a1323aa85082051965aemattsnider
d3ac39f387c773c28001a1323aa85082051965aemattsnider
d3ac39f387c773c28001a1323aa85082051965aemattsnider/*
d3ac39f387c773c28001a1323aa85082051965aemattsnider
d3ac39f387c773c28001a1323aa85082051965aemattsnider var el = Y.get('#button1');
d3ac39f387c773c28001a1323aa85082051965aemattsnider Y.log("get got " + el);
d3ac39f387c773c28001a1323aa85082051965aemattsnider el.setStyle('border', '3px solid red');
d3ac39f387c773c28001a1323aa85082051965aemattsnider
d3ac39f387c773c28001a1323aa85082051965aemattsnider var f = function(e) {
d3ac39f387c773c28001a1323aa85082051965aemattsnider Y.log("SUB1, " + this.get('id') + " click event facade: " + e.target);
d3ac39f387c773c28001a1323aa85082051965aemattsnider e.stopPropagation();
d3ac39f387c773c28001a1323aa85082051965aemattsnider // e.stopImmediatePropagation();
d3ac39f387c773c28001a1323aa85082051965aemattsnider }
d3ac39f387c773c28001a1323aa85082051965aemattsnider
d3ac39f387c773c28001a1323aa85082051965aemattsnider var h =Y.on('click', f, el);
d3ac39f387c773c28001a1323aa85082051965aemattsnider
d3ac39f387c773c28001a1323aa85082051965aemattsnider Y.on('click', function(e) {
d3ac39f387c773c28001a1323aa85082051965aemattsnider Y.log("SUB2, " + this.get('id') + " click event facade: " + e.target);
d3ac39f387c773c28001a1323aa85082051965aemattsnider h.detach();
d3ac39f387c773c28001a1323aa85082051965aemattsnider // Y.detach('click', f, el);
d3ac39f387c773c28001a1323aa85082051965aemattsnider // Y.Event.purgeElement(this);
d3ac39f387c773c28001a1323aa85082051965aemattsnider }, el);
d3ac39f387c773c28001a1323aa85082051965aemattsnider
d3ac39f387c773c28001a1323aa85082051965aemattsnider*/
3f8c8f56d68f749e363b10328b2a5c97a5c96863Jenny Donnelly
3f8c8f56d68f749e363b10328b2a5c97a5c96863Jenny Donnelly
d3ac39f387c773c28001a1323aa85082051965aemattsnider
d3ac39f387c773c28001a1323aa85082051965aemattsnider var ret = Y.on('click', function(e) {
d3ac39f387c773c28001a1323aa85082051965aemattsnider Y.log(this.get('id') + " click event facade: " + e.target);
d3ac39f387c773c28001a1323aa85082051965aemattsnider }, '#button2');
d3ac39f387c773c28001a1323aa85082051965aemattsnider
d3ac39f387c773c28001a1323aa85082051965aemattsnider Y.log('ret: ' + Y.Lang.dump(ret, 1));
d3ac39f387c773c28001a1323aa85082051965aemattsnider
d3ac39f387c773c28001a1323aa85082051965aemattsnider var buts = Y.Node.all('.button');
d3ac39f387c773c28001a1323aa85082051965aemattsnider
d3ac39f387c773c28001a1323aa85082051965aemattsnider Y.log('queryAll buttons: ' + Y.Lang.dump(buts.get('length')));
d3ac39f387c773c28001a1323aa85082051965aemattsnider
d3ac39f387c773c28001a1323aa85082051965aemattsnider buts.each(function(v, k) {
d3ac39f387c773c28001a1323aa85082051965aemattsnider Y.log('blah: ' + v);
d3ac39f387c773c28001a1323aa85082051965aemattsnider });
d3ac39f387c773c28001a1323aa85082051965aemattsnider
3f8c8f56d68f749e363b10328b2a5c97a5c96863Jenny Donnelly Y.each(buts, function(v, k) {
0d6d1a2d994933a68a100ec3dcdc7c7a0eeeae6cJenny Han Donnelly Y.log('blah2: ' + v);
8392a541bf432ed8d6e1985b6306b83dc898768dJenny Han Donnelly });
d3ac39f387c773c28001a1323aa85082051965aemattsnider
d3ac39f387c773c28001a1323aa85082051965aemattsnider/*
d3ac39f387c773c28001a1323aa85082051965aemattsnider Y.on('mouseover', function(e) {
d3ac39f387c773c28001a1323aa85082051965aemattsnider // alert('asdf');
d3ac39f387c773c28001a1323aa85082051965aemattsnider Y.log(this.id || this.get('id') + " mouseover: " + e.target);
d3ac39f387c773c28001a1323aa85082051965aemattsnider // }, Y.Node.queryAll('.button'));
d3ac39f387c773c28001a1323aa85082051965aemattsnider //}, Y.Selector.query('.button'));
d3ac39f387c773c28001a1323aa85082051965aemattsnider }, ['#button1', '#button2']);
d3ac39f387c773c28001a1323aa85082051965aemattsnider */
d3ac39f387c773c28001a1323aa85082051965aemattsnider
d3ac39f387c773c28001a1323aa85082051965aemattsnider /*
d3ac39f387c773c28001a1323aa85082051965aemattsnider
d3ac39f387c773c28001a1323aa85082051965aemattsnider Y.on('TEST:EVENT', function() {
d3ac39f387c773c28001a1323aa85082051965aemattsnider Y.log('test event subscriber success: ' + Y.Array(arguments));
d3ac39f387c773c28001a1323aa85082051965aemattsnider });
d3ac39f387c773c28001a1323aa85082051965aemattsnider
d3ac39f387c773c28001a1323aa85082051965aemattsnider Y.fire('TEST:EVENT', 1, 2);
d3ac39f387c773c28001a1323aa85082051965aemattsnider
d3ac39f387c773c28001a1323aa85082051965aemattsnider Y.fire('asdf:asdf', 1);
d3ac39f387c773c28001a1323aa85082051965aemattsnider
d3ac39f387c773c28001a1323aa85082051965aemattsnider Y.fire('asdf', 1);
d3ac39f387c773c28001a1323aa85082051965aemattsnider */
d3ac39f387c773c28001a1323aa85082051965aemattsnider
d3ac39f387c773c28001a1323aa85082051965aemattsnider /*
d3ac39f387c773c28001a1323aa85082051965aemattsnider
d3ac39f387c773c28001a1323aa85082051965aemattsnider var obj = new Y.Event.Target();
d3ac39f387c773c28001a1323aa85082051965aemattsnider
d3ac39f387c773c28001a1323aa85082051965aemattsnider
d3ac39f387c773c28001a1323aa85082051965aemattsnider // test failure
0d6d1a2d994933a68a100ec3dcdc7c7a0eeeae6cJenny Han Donnelly obj.subscribe('foo', function() {
d3ac39f387c773c28001a1323aa85082051965aemattsnider Y.info(notdefined);
d3ac39f387c773c28001a1323aa85082051965aemattsnider });
d3ac39f387c773c28001a1323aa85082051965aemattsnider
d3ac39f387c773c28001a1323aa85082051965aemattsnider obj.subscribe('foo', function() {
d3ac39f387c773c28001a1323aa85082051965aemattsnider Y.info(notdefined);
d3ac39f387c773c28001a1323aa85082051965aemattsnider });
d3ac39f387c773c28001a1323aa85082051965aemattsnider
d3ac39f387c773c28001a1323aa85082051965aemattsnider obj.subscribe('foo', function() {
d3ac39f387c773c28001a1323aa85082051965aemattsnider Y.info('foo fired anyway!');
d3ac39f387c773c28001a1323aa85082051965aemattsnider });
d3ac39f387c773c28001a1323aa85082051965aemattsnider
d3ac39f387c773c28001a1323aa85082051965aemattsnider try {
d3ac39f387c773c28001a1323aa85082051965aemattsnider obj.fire('foo');
d3ac39f387c773c28001a1323aa85082051965aemattsnider } catch(e) {
d3ac39f387c773c28001a1323aa85082051965aemattsnider Y.warn('fire() error: ' + Y.Lang.dump(e.errors));
d3ac39f387c773c28001a1323aa85082051965aemattsnider }
d3ac39f387c773c28001a1323aa85082051965aemattsnider */
d3ac39f387c773c28001a1323aa85082051965aemattsnider
b9436848b51ee2b4f04b9217e74172c5a05ce276Jenny Han Donnelly //if (Object.prototype.hasOwnProperty) {
8392a541bf432ed8d6e1985b6306b83dc898768dJenny Han Donnelly //alert('asdf');
b9436848b51ee2b4f04b9217e74172c5a05ce276Jenny Han Donnelly //}
8392a541bf432ed8d6e1985b6306b83dc898768dJenny Han Donnelly //window.blah ="ad"
8392a541bf432ed8d6e1985b6306b83dc898768dJenny Han Donnelly //alert(window.hasOwnProperty('blah'));
8392a541bf432ed8d6e1985b6306b83dc898768dJenny Han Donnelly //alert(window.hasOwnProperty('document'));
8392a541bf432ed8d6e1985b6306b83dc898768dJenny Han Donnelly
8392a541bf432ed8d6e1985b6306b83dc898768dJenny Han Donnelly //alert(Y.object.owns(window, 'blah'));
8392a541bf432ed8d6e1985b6306b83dc898768dJenny Han Donnelly
8392a541bf432ed8d6e1985b6306b83dc898768dJenny Han Donnelly var a = [
8392a541bf432ed8d6e1985b6306b83dc898768dJenny Han Donnelly 1,
8392a541bf432ed8d6e1985b6306b83dc898768dJenny Han Donnelly 2,
8392a541bf432ed8d6e1985b6306b83dc898768dJenny Han Donnelly ];
8392a541bf432ed8d6e1985b6306b83dc898768dJenny Han Donnelly
8392a541bf432ed8d6e1985b6306b83dc898768dJenny Han Donnellyvar handle;
8392a541bf432ed8d6e1985b6306b83dc898768dJenny Han Donnellyfunction handleClick(){
8392a541bf432ed8d6e1985b6306b83dc898768dJenny Han Donnelly Y.log(handle);
b9436848b51ee2b4f04b9217e74172c5a05ce276Jenny Han Donnelly}
8392a541bf432ed8d6e1985b6306b83dc898768dJenny Han Donnelly
8392a541bf432ed8d6e1985b6306b83dc898768dJenny Han Donnelly/*
8392a541bf432ed8d6e1985b6306b83dc898768dJenny Han Donnelly
8392a541bf432ed8d6e1985b6306b83dc898768dJenny Han Donnellyvar body = Y.Node.get("body");
b9436848b51ee2b4f04b9217e74172c5a05ce276Jenny Han Donnellyhandle = body.on("click", handleClick);
b9436848b51ee2b4f04b9217e74172c5a05ce276Jenny Han Donnelly*/
8392a541bf432ed8d6e1985b6306b83dc898768dJenny Han Donnelly
8392a541bf432ed8d6e1985b6306b83dc898768dJenny Han Donnelly//click to confirm it's attached
0d6d1a2d994933a68a100ec3dcdc7c7a0eeeae6cJenny Han Donnelly
d3ac39f387c773c28001a1323aa85082051965aemattsnider// body.detach("click", handleClick);
d3ac39f387c773c28001a1323aa85082051965aemattsnider
d3ac39f387c773c28001a1323aa85082051965aemattsnider// handle.detach();
d3ac39f387c773c28001a1323aa85082051965aemattsnider
d3ac39f387c773c28001a1323aa85082051965aemattsnider//click again, will still show the alert
d3ac39f387c773c28001a1323aa85082051965aemattsnider
d3ac39f387c773c28001a1323aa85082051965aemattsnider// for (var i in window) {
d3ac39f387c773c28001a1323aa85082051965aemattsnider // Y.log(i);
d3ac39f387c773c28001a1323aa85082051965aemattsnider// }
d3ac39f387c773c28001a1323aa85082051965aemattsnider
d3ac39f387c773c28001a1323aa85082051965aemattsnider//A function that pops up a "Hello World" alert:
d3ac39f387c773c28001a1323aa85082051965aemattsnidervar helloWorld = function(e) {
d3ac39f387c773c28001a1323aa85082051965aemattsnider Y.log("helloWorld function firing.", "info", "example");
d3ac39f387c773c28001a1323aa85082051965aemattsnider alert("Hello World!");
d3ac39f387c773c28001a1323aa85082051965aemattsnider}
d3ac39f387c773c28001a1323aa85082051965aemattsnider
d3ac39f387c773c28001a1323aa85082051965aemattsnider/*
d3ac39f387c773c28001a1323aa85082051965aemattsnider
d3ac39f387c773c28001a1323aa85082051965aemattsnider//subscribe the helloWorld function as an event
d3ac39f387c773c28001a1323aa85082051965aemattsnider//handler for the click event on the container
d3ac39f387c773c28001a1323aa85082051965aemattsnider//div:
8392a541bf432ed8d6e1985b6306b83dc898768dJenny Han DonnellyY.on("click", helloWorld, "#container");
8392a541bf432ed8d6e1985b6306b83dc898768dJenny Han Donnelly*/
8392a541bf432ed8d6e1985b6306b83dc898768dJenny Han Donnelly
8392a541bf432ed8d6e1985b6306b83dc898768dJenny Han Donnelly
8392a541bf432ed8d6e1985b6306b83dc898768dJenny Han Donnelly//A function that pops up an alert and
d3ac39f387c773c28001a1323aa85082051965aemattsnider//prevents the default behavior of the event
8392a541bf432ed8d6e1985b6306b83dc898768dJenny Han Donnelly//for which it is a handler:
8392a541bf432ed8d6e1985b6306b83dc898768dJenny Han Donnellyvar interceptLink = function(e) {
8392a541bf432ed8d6e1985b6306b83dc898768dJenny Han Donnelly // e.preventDefault();
8392a541bf432ed8d6e1985b6306b83dc898768dJenny Han Donnelly alert('asdf');
8392a541bf432ed8d6e1985b6306b83dc898768dJenny Han Donnelly e.halt();
d3ac39f387c773c28001a1323aa85082051965aemattsnider Y.log("You clicked on the second YUI link.", "info", "example");
d3ac39f387c773c28001a1323aa85082051965aemattsnider alert("You clicked on the second YUI link. Because *preventDefault* was called, this link will not navigate away from the page.");
d3ac39f387c773c28001a1323aa85082051965aemattsnider}
8392a541bf432ed8d6e1985b6306b83dc898768dJenny Han Donnelly
8392a541bf432ed8d6e1985b6306b83dc898768dJenny Han Donnelly//subscribe our interceptLink function
d3ac39f387c773c28001a1323aa85082051965aemattsnider//as a click handler for the second anchor
d3ac39f387c773c28001a1323aa85082051965aemattsnider//element:
d3ac39f387c773c28001a1323aa85082051965aemattsniderY.on("click", interceptLink, "#secondA");
d3ac39f387c773c28001a1323aa85082051965aemattsnider
d3ac39f387c773c28001a1323aa85082051965aemattsnider// Y.Event.onAvailable("#secondA", function() {
d3ac39f387c773c28001a1323aa85082051965aemattsnider// Y.log('#secondA is READY');
d3ac39f387c773c28001a1323aa85082051965aemattsnider// });
d3ac39f387c773c28001a1323aa85082051965aemattsnider
0d6d1a2d994933a68a100ec3dcdc7c7a0eeeae6cJenny Han DonnellyY.on('available', function() {
d3ac39f387c773c28001a1323aa85082051965aemattsnider Y.log('#secondA is READY');
d3ac39f387c773c28001a1323aa85082051965aemattsnider Y.log(arguments);
d3ac39f387c773c28001a1323aa85082051965aemattsnider}, '#secondA', Y, 1, 2);
d3ac39f387c773c28001a1323aa85082051965aemattsnider
d3ac39f387c773c28001a1323aa85082051965aemattsnider
d3ac39f387c773c28001a1323aa85082051965aemattsnider//log message to indicate that the example is ready:
d3ac39f387c773c28001a1323aa85082051965aemattsniderY.log("When you begin interacting with the example at left, you'll see log messages appear here.", "info", "example");
d3ac39f387c773c28001a1323aa85082051965aemattsnider
d3ac39f387c773c28001a1323aa85082051965aemattsniderY.on('windowresize', function(e) {
d3ac39f387c773c28001a1323aa85082051965aemattsnider Y.log('window resize');
b9436848b51ee2b4f04b9217e74172c5a05ce276Jenny Han Donnelly});
d3ac39f387c773c28001a1323aa85082051965aemattsnider
8392a541bf432ed8d6e1985b6306b83dc898768dJenny Han Donnelly});
8392a541bf432ed8d6e1985b6306b83dc898768dJenny Han Donnelly
8392a541bf432ed8d6e1985b6306b83dc898768dJenny Han Donnelly</script>
8392a541bf432ed8d6e1985b6306b83dc898768dJenny Han Donnelly
8392a541bf432ed8d6e1985b6306b83dc898768dJenny Han Donnelly<div id="container">new msgs</div>
0d6d1a2d994933a68a100ec3dcdc7c7a0eeeae6cJenny Han Donnelly
8392a541bf432ed8d6e1985b6306b83dc898768dJenny Han Donnelly<p>
0d6d1a2d994933a68a100ec3dcdc7c7a0eeeae6cJenny Han Donnelly<a href="http://developer.yahoo.com/yui" id="firstA">The YUI Library. (Link navigates away from page.)</a>
8392a541bf432ed8d6e1985b6306b83dc898768dJenny Han Donnelly</p>
0d6d1a2d994933a68a100ec3dcdc7c7a0eeeae6cJenny Han Donnelly
d3ac39f387c773c28001a1323aa85082051965aemattsnider<p>
<a href="http://developer.yahoo.com/yui" id="secondA">The YUI Library. (Link's default behavior is suppressed.)</a>
</p>
<form>
<input type="radio" id="radio1" name="radiocollection[]" />
</form>
</body>
</html>