3 ms·
While event delegation doesn't work 100% of the time (e.g. when another piece of code that uses capture instead of bubbling such as google maps API), I wouldn't
by IgorPartola 17y ago
While event delegation doesn't work 100% of the time (e.g. when another piece of code that uses capture instead of bubbling such as google maps API), I wouldn't consider it a hack. Of course event handling will be slower but we can test how much slower :).
You can do that with jQuery as well and that's an ineresting performance comparison in itself. E.g. $('.class:visible:not(:eq(1))') vs $('.class').filter(':visible').not(':eq(1)').
I suspect it heavily depends on the size of the DOM tree and the number of elements.
- MadRabbit 17y agoAt the beginning you're kinda was against the "make" test, because there is no such thing in jQuery, and now you practically offer the same thing, to test something that does exist in jQuery but doesn't in RighJS. You should choose already what do you stand for. But anyway, if you want to test it go ahead, you know where the code is. I suppose jQuery handles virtual selectors via JavaScript and therefore there will be no serious difference in performance. I even suspect that a single additional function in the filter method in RightJS will still work faster than several internal selectors in jQuery.