Opened 10 years ago
Closed 10 years ago
#13655 closed feature (fixed)
Create unit test for window.load .ready() fallback
Reported by: | m_gol | Owned by: | |
---|---|---|---|
Priority: | undecided | Milestone: | None |
Component: | unfiled | Version: | 2.0b2 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
I was wondering, is a fallback from document
DOMContentLoaded
to window
load
in jQuery.ready.promise
still needed in jQuery 2.x? (line 789 in src/core.js on master). IE supports it from 9 but other browsers have had support for much longer time; it's also supported on old Android (at least 2.3).
This would save a few bytes if it's not needed any more.
Change History (8)
comment:1 Changed 10 years ago by
comment:2 Changed 10 years ago by
https://github.com/jquery/jquery/pull/1209
I've run the full test suite in current Chrome, Firefox & Safari as well as in IE9 & IE10 and all went fine (though, obviously, any bugs here might not be catched in a usual test).
I don't have any Android devices to test, though.
comment:3 Changed 10 years ago by
Is it possible for jQuery to be loaded after DOMContentLoaded, but before the load event has occurred ( think RequireJS or some other script loader )?
If that's the case, then jQuery.ready would never be fired since document.readyState would be "interactive" at that point.
comment:4 Changed 10 years ago by
window.load is needed for the reason dcherman describes. A long loading iframe on a page could keep the page "interactive" if jQuery is async loaded after DomContentLoaded. Rather than remove the fallback maybe write a test proving its necessity?
comment:6 Changed 10 years ago by
I updated my pull request, reverting the removal and adding a test, see there for further comments & remarks:
https://github.com/jquery/jquery/pull/1209
comment:7 Changed 10 years ago by
Status: | new → open |
---|---|
Summary: | Remove DOMContentLoaded fallback to window load? → Create unit test for window.load .ready() fallback |
Marking as open and renaming to reflect the end result since we're not removing the fallback.
comment:8 Changed 10 years ago by
Resolution: | → fixed |
---|---|
Status: | open → closed |
Fix #13655. Add test for jQuery.ready.promise fallback load. Close gh-1209.
Changeset: 32b066d3805a48f8c8312562ed52a1b5910b1d85
Give it a shot