Live data from Hacker News

Faster than jQuery(document).ready() - Wait Until Exists

javascriptisawesome.blogspot.com

1–10 of 48 posts

Re: Faster than jQuery(document).ready() - Wait Until Exists

#5
Quick remarks :

* I could test it myself, but I expected to have in the article detailed information on the different possible states the document can have when my callback is called. The questions I know the answer when waiting for the whole document to be loaded : Is it half loaded ? What is the DOM state ? Is completely loaded ? If not, have the document JavaScript code been entirely ran ? and so on. This kind of question left unanswered often lead to hard bites.

* why using "itself" ? I would have used a "sensible default" : when no context is given, use the waited DOM object instead of an arbitrary value (document), and use something else when it is explicitly given. The "itself" thing should be left as an internal flag IMHO.

Re: Faster than jQuery(document).ready() - Wait Until Exists

#8
DOMNodeInserted is deprecated in the DOM Level 3 Events recommendation, along with all the other mutation events:

http://www.w3.org/TR/DOM-Level-3-Events/#event-type-DOMNodeI...

They have been deprecated because they perform poorly:

> Firefox, for example, when it realizes that a mutation event has been turned on, instantly goes into an incredibly-slow code path where it has to fire events at every single DOM modification. This means that doing something like .innerHTML = "foo" where it wipes out 1000 elements would fire, at least 1000 + 1 events (1000 removal events, 1 addition event).

http://lists.w3.org/Archives/Public/www-dom/2009AprJun/0072....

> Mutation Events are widely acknowledged as “slow” in terms of the real performance degradation that occurs on websites that use them heavily for tracking changes to the DOM

http://www.w3.org/2008/webapps/wiki/MutationReplacement

Re: Faster than jQuery(document).ready() - Wait Until Exists

#9

DOMNodeInserted is deprecated in the DOM Level 3 Events recommendation, along with all the other mutation events: http://www.w3.org/TR/DOM-Level-3-Events/#event-type-DOMNodeI... They have been deprecated because they perform poorly: > Firefox, for example, when it realizes that a mutation event has been turned on, instantly goes into an incredibly-slow code path where it has to fire events at every single DOM modific…

The spec says "A new specification is under development with the aim of addressing the use cases that mutation events solves, but in more performant manner." so hopefully it won't be too hard to port things like this over... I hope so anyway, because the mutation events are mighty handy!
Post reply on HN