What is the difference between DOMContentLoaded and DOMContentReady?
Asked Answered
P

2

9

According to the MDN wiki, DOMContentLoaded will fire when "page's DOM is ready, [although] the referenced stylesheets, images, and subframes may not be done loading."

What about DOMContentReady? Is it just an alias?

Pelson answered 5/8, 2012 at 14:36 Comment(8)
DOMContentReady? Is that a real event type? Source please.Trautman
Take a look at this: src.chromium.org/viewvc/chrome/trunk/src/chrome/common/…Pelson
Is that code your only source? If yes, it might be a typo.Trautman
It is also used all over this question - but no link to a spec or such.Longish
Apart from that, there is a readyStateChange eventLongish
@Longish I think the participants of that thread just mistook it for the actual "DOMContentLoaded" event type.Trautman
@ŠimeVidas It's not a typo; the commit that introduced this code has been peer-reviewed. If you still don't believe me, just google DOMContentReady.Pelson
@Pelson Peer-review is done by humans, and is therefore subject to mistakes. Google gives 4400 results which all seem to be pointing to user discussions, with no results pointing to actual documentation. I reason that it's a typo or a lapsus memoriae.Trautman
J
12

I'm making the claim that the event type "DOMContentReady" does not exist in current implementations (meaning, that no current implementation fires such an event type), and that appearances of such a name are merely lapsus memoriae.

The name "DOMContentLoaded" is not easily remembered, and since the jQuery library uses the method .ready() to bind this event type, I guess, some people just mistakenly used the name "DOMContentReady" to refer to the correct name "DOMContentLoaded".

Jungle answered 5/8, 2012 at 15:28 Comment(0)
O
0

As far as I know DOMContentReady is not a standard event. Just stick with DOMContentLoaded.

Oberammergau answered 5/8, 2012 at 14:46 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.