<ul id="demo">
<li>foo</li>
<li>bar</li>
</ul>
<script type="text/javascript">
YUI().use('node', function(Y) {
var onClick = function(e) {
var node = e.currentTarget;
node.prepend('<em>prepended</em> '); // added as firstChild
node.append(' <em>appended</em>'); // added as lastChild
node.insert(' <strong>before last child</strong> ', node.get('lastChild')); // added before lastChild
node.insert(' <strong>before childNodes[1]</strong> ', 1); // added before childNodes[1]
};
Y.all('#demo li').on('click', onClick);
});
</script>