Skip to content

Check document.readyState === "interactive" on $(document).ready #2100

@stackia

Description

@stackia

https://github.com/jquery/jquery/blob/master/src/core/ready.js#L81

As the comment mentioned, IE9 will probably give an incorrect "interactive" readyState. But that only affects IE9. Should "interactive" be accepted on other browsers? I'm using require.js to load my scripts and exactly jQuery and many other scripts are loaded after DOMContentLoaded but before fully loaded. Scripts depending on $(document).ready have to wait until load event is triggered.

Currently I use document.readyState === "interactive" ? init() : $(document).ready(init); to get around this problem.

https://github.com/ded/domready/blob/master/src/ready.js#L16
This is another implementation of domReady which accept "interactive" readyState on browsers excluding IE.

Is there any reason why jQuery doesn't do that?

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions