Why iUI Extension Event Bubbling is Good

42 views
Skip to first unread message

Sean Gilligan

unread,
Aug 29, 2012, 1:45:52 PM8/29/12
to iui-dev...@googlegroups.com
In my previous e-mail about Event Bubbling I focused on the fact that
the change would require changes to extensions or apps using the iUI
event mechanism, but I didn't really explain why it is a GOOD thing. (I
did mention that it removed a bunch of code from extensions, which is
definitely a good thing.)

It's really a key fix to one of the mian features of the 0.4 roadmap --
extension support. Without it, every extension must use afterInsert to
add listeners for every node that is AJAXed in. With it all extensions
apply to all AJAX-inserted nodes automatically.

It is similar in concept to the jQuery .delegate() method:
http://api.jquery.com/delegate/
(or the older jquery .live() method)

Ever since I learned about those, I had a nagging feeling we were (I
was) doing this wrong. And now I'm embarrassed it took so long for me
(or anyone else) to discover or implement it.

I started thinking about it again when we removed querySelectorAll() for
getAllViews() and spent a couple hours looking in to it. Once I saw
that it worked and how easy it was to do, I knew we needed to get in to
a release right away. Before writing better extension documentation
and before too many people write extensions based upon 0.4.

It's a huge win.

-- Sean

Reply all
Reply to author
Forward
0 new messages