As we all know, since jQuery 1.7:
$('someSelector').live('click', fn());
has become, essentially:
$(document).on('click', 'someSelector', fn());
All live events aren't directly bound to the elements in the selector, but delegate bound to the document.
This, I assume, is because elements that would match 'someSelector'
in the future, aren't present in the DOM, so can't have event handlers bound (via direct or delegate binding).
For single page applications where the vast majority, if not all elements are dynamically loaded, are there published guidelines about how best to handle the issue of performance with binding everything to the document?
Covering, for instance, the best way to register/re-register event handlers when new content is loaded via ajax()
and how to update code written in the lazy .live()
mindset?