nodelist.html revision e56c4e11f404542db23efd22779d04fd7e8ff5ea
<html>
<head>
<title>FIXME</title>
</style>
</head>
<body>
<div id="demo" class="foo">
<p id="lorem">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);
});
//node.set('innerHTML', 'new content from Node');
//node.setStyle('color', 'red');
nodelist.setStyle('color', 'red');
console.log(Y.all('body').get('nodeName'));
/*
Y.get('body').on('firstChildChange', function(e) {
console.log(e);
});
node.after('innerHTMLChange', function(e) {
console.log('Node: afterInnerHTMLChange');
});
nodelist.on('innerHTMLChange', function(e) {
});
var onClick = function(e) {
//e.preventDefault();
console.log('node click');
};
nodelist.on('click', onClick);
nodelist.on('refresh', function(e) {
e.added.on('click', onClick);
});
nodelist.set('innerHTML', 'new content from NodeList');
console.log(Y.get('#demo').get('children').set('innerHTML', 'foo'));
console.log(Y.get('#demo').hasClass('foo'));
console.log(Y.get('#demo').addClass('bar'));
console.log(Y.get('#demo').hasClass('bar'));
console.log(nodelist.item(0).get('id'));
nodelist.each(function(n) {
n.set('innerHTML', 'set by nodelist.each()');
});
*/
});
</script>
</body>
</html>