繁体   English   中英

DOMContentLoaded和DOMContentReady有什么区别?

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

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

那么DOMContentReady呢? 它只是一个别名吗?

我声称事件类型“DOMContentReady”在当前实现中不存在(意思是,没有当前实现触发这样的事件类型),并且这样的名称的出现仅仅是lapsus memoriae

名称“DOMContentLoaded”不容易被记住,并且由于jQuery库使用方法.ready()来绑定此事件类型,我猜,有些人错误地使用名称“DOMContentReady”来引用正确的名称“DOMContentLoaded” 。

据我所知, DOMContentReady不是标准事件。 坚持使用DOMContentLoaded

暂无
暂无

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

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