Showing DOM events behavior

by ariehg

HTML

<a href='#'>bla</a>
<ul id='msgs'></ul>

JavaScript

var a = $$('a')[0]
   , ul = $('msgs');

a.addEvent('click',function(){
   ul.adopt(new Element('li',{text:'abc'}));
});
a.addEvent('click',function(){
    //this won't work and will throw a TypeError
    ul.adopt(new Element('li',{text:def})); 
});
a.addEvent('click',function(){
    ul.adopt(new Element('li',{text:'ghi'}));
});