Also note that while delegation is usually better than attaching several events, sometimes, especially with mouseover, it's best not to use it--like on a large element that has very few matching delegates, it'll keep the browser pretty busy checking for matches over and over.
On Feb 1, 2011, at 11:20 AM, Aaron Newton wrote: > Also, delegated events get two variables passed to thief handlers, the event > and the target. The e.target below will refer to the parent element that you > called addevent on. Mouse enter isn't needed with delegation; just use > mouseover:relay(li) and use that second argument. > > Sorry for any typos. Tiny buttons, big thumbs... > > On Feb 1, 2011, at 9:41 AM, stratboy <[email protected]> wrote: > >> Hi! take a look: >> >> http://jsfiddle.net/stratboy/pmz9M/1/ >> >> if you don't comment the morph call here: >> >> 'mouseenter:relay(li)':function(e){ >> var t = $(e.target); >> t.morph('.hover'); >> } >> >> you get errors. Why? Is it a bug?
