nodelist.html revision d2bacf915570731779738821c6d7b01b7d9600fe
<html>
<head>
<title>FIXME</title>
</style>
</head>
<body>
<div id="demo">
<p>lorem</p>
<p title="ipsum">ipsum</p>
<p>dolor</p>
<p>sit</p>
</div>
<script type="text/javascript">
YUI().use('*', function(Y) {
var a = ['foo', 'bar', 'baz:', 'fool'],
b = ['foo', 'baz', 'boo', 'bool'];
nodelist = Y.all('p');
//nodelist.set('style.color', 'red');
node = Y.get('p[title]');
/*
1. set title on all nodes
store initial value === prevVal
2. provide prevVal array in handler
3. fire node titleChange
4. fire nodelist titleChange
*/
node.on('innerHTMLChange', function(e) {
e.newVal = 'hijacked val';
this._defAttrChangeFn(e);
console.log(e);
});
//node.set('innerHTML', 'new content from Node');
node.after('innerHTMLChange', function(e) {
console.log('Node: afterInnerHTMLChange');
});
nodelist.on('innerHTMLChange', function(e) {
});
nodelist.on('click', function(e) {
//e.preventDefault();
console.log('node click');
});
nodelist.set('innerHTML', 'new content from NodeList');
//console.log(nodelist.get('title'));
});
</script>
</body>
</html>