Delegator on numerous elements?

9 views
Skip to first unread message

Rolf-nl

unread,
Dec 30, 2012, 4:24:34 PM12/30/12
to clien...@googlegroups.com
Last one for 2012..

How does Delegator fit into the other idea of event delegation where you declare an action on some parent relaying it to childs?
Let's say I have a table with 10 or 500 rows and there's a "remove row" link in each row. There's no fancy class involved that does other stuff to the table.

document.id('myTable').addEvent('click:relay(a.remove)', function(){ ... })

With Delegator I would decorate the links for each row like <a href="#" data-trigger="RemoveRow">remove</a> or something... but isn't this inefficient when you have many rows?

Aaron Newton

unread,
Dec 30, 2012, 7:40:38 PM12/30/12
to clien...@googlegroups.com
Delegator doesn't parse the HTML on startup or anything, only on event. So if you had decorators on each such row it wouldn't have any cost (other than the additional bytes for the HTML payload). This is how it is intended to work.

--
You received this message because you are subscribed to the Google Groups "Clientcide" group.
To view this discussion on the web visit https://groups.google.com/d/msg/clientside/-/n-XdUayM-z0J.
To post to this group, send email to clien...@googlegroups.com.
To unsubscribe from this group, send email to clientside+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/clientside?hl=en.

Reply all
Reply to author
Forward
0 new messages