8 ms·
I'm not sure he knows how .live works. .live doesn't wait for items to be ready and it only binds one event on to the top level document. .live waits for bubble
by peregrine 16y ago
I'm not sure he knows how .live works. .live doesn't wait for items to be ready and it only binds one event on to the top level document. .live waits for bubbled events and if the item bubbling the event matches this .live selector it calls back. Pretty smart if you think about it.
But either way he makes a great point on the document.ready if your page depends on ajax or some sort of ui styling its probably best in the header script.
- Encosia 16y agoRight, that's the crux of my overall point about .live(). Since it's using event delegation, the DOM elements don't need to be present at the time you declare it. If you have the opportunity to set up your .live() handlers early, you should.
- deleted 16y ago[deleted]