selector.html revision d98d5e2bbc3fcf2015c549dd94c4c0371b3fdbe7
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><title>XDR test</title></head><body>
<h1>XDR Test</h1>
<div>
<ul id="list">
<li id="one" class="odd">Item one</li>
<li id="two" class="even">Item two</li>
<li id="three" class="odd">Item three</li>
<li id="four" class="even">Item four</li>
</ul>
</div>
<script type="text/javascript" src="/build/yui/yui-debug.js"></script>
<script language="javascript">
//Create YUI instance:
var Y = new YUI({
base: '/build/',
filter: 'debug'
}).use("node", "dump", function(Y) {
//create arbitrary context object:
var contextObj = {
name: "context"
};
//function to handle click events and report information about them:
function handleClick(e, arg1, arg2) {
Y.log(Y.dump(this));
Y.log(Y.dump(e));
Y.log(arguments);
}
//subscribe odd numbered list items to the click event
Y.on("click", handleClick, "#list .odd", contextObj, "argumentOne", "argumentTwo");
// Y.on("click", handleClick, document, contextObj, "argumentOne", "argumentTwo");
});
</script>
</body></html>