简体   繁体   English

DOMContentLoaded和DOMContentReady有什么区别?

[英]What is the difference between DOMContentLoaded and DOMContentReady?

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." 根据MDN wiki, DOMContentLoaded将在“页面的DOM准备就绪时触发,[尽管]引用的样式表,图像和子帧可能无法加载。”

What about DOMContentReady ? 那么DOMContentReady呢? Is it just an alias? 它只是一个别名吗?

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 . 我声称事件类型“DOMContentReady”在当前实现中不存在(意思是,没有当前实现触发这样的事件类型),并且这样的名称的出现仅仅是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". 名称“DOMContentLoaded”不容易被记住,并且由于jQuery库使用方法.ready()来绑定此事件类型,我猜,有些人错误地使用名称“DOMContentReady”来引用正确的名称“DOMContentLoaded” 。

As far as I know DOMContentReady is not a standard event. 据我所知, DOMContentReady不是标准事件。 Just stick with DOMContentLoaded . 坚持使用DOMContentLoaded

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM