nodelist.html revision 9fd236427d8cf0758974e1ae152f221064b341e1
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>FIXME</title>
<script type="text/javascript" src="/build/yui/yui.js"></script>
<script type="text/javascript" src="/build/event-custom/event-custom.js"></script>
<script type="text/javascript" src="/build/event-simulate/event-simulate.js"></script>
<script type="text/javascript" src="/build/event/event.js"></script>
<script type="text/javascript" src="/build/oop/oop.js"></script>
<script type="text/javascript" src="/build/base/base.js"></script>
<script type="text/javascript" src="/build/attribute/attribute.js"></script>
<script type="text/javascript" src="/build/dom/dom-debug.js"></script>
<script type="text/javascript" src="/build/dom/selector-css3-debug.js"></script>
<script type="text/javascript" src="/build/node/node-debug.js"></script>
<style type="text/css">
</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>
<div class="bar">bar</div>
<div class="baz">bar</div>
<ol start=0>
<li>foo</li>
<li>foo</li>
<li>foo</li>
<li>foo</li>
<li>foo</li>
<li>foo</li>
<li>foo</li>
</ol>
<script type="text/javascript">
YUI().use('*', function(Y) {
nodelist = Y.all('li').even().set('innerHTML', 'bar');
console.log(nodelist.size());
/*
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.preventDefault();
e.newVal = 'hijacked val';
this._defAttrChangeFn(e);
console.log('Node: ' + e.type + ': ' + e.target._yuid);
});
//node.set('innerHTML', 'new content from Node');
//node.setStyle('color', 'red');
nodelist.setStyle('color', 'red');
console.log(Y.all('body').get('firstChild.nodeName'));
console.log(Y.get('body').get('firstChild.nodeName'));
Y.get('body').on('firstChildChange', function(e) {
console.log(e);
e.preventDefault();
});
console.log(Y.get('body').set('firstChild.nextSibling.innerHTML', 'foo'));
node.after('innerHTMLChange', function(e) {
console.log('Node: afterInnerHTMLChange');
});
nodelist.on('innerHTMLChange', function(e) {
//console.log('NodeList: ' + e.type + ': ' + e.target);
});
var onClick = function(e) {
//e.preventDefault();
console.log('node click');
};
nodelist.on('click', onClick);
Y.get('#demo').addNode('<p>injected content</p>');
nodelist.on('refresh', function(e) {
e.added.on('click', onClick);
});
nodelist.refresh();
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>