Skip to main content

Bug Tracker

Side navigation

#13655 closed feature (fixed)

Opened March 24, 2013 02:40AM UTC

Closed April 04, 2013 05:36PM UTC

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.

Attachments (0)
Change History (8)

Changed March 24, 2013 02:42AM UTC by rwaldron comment:1

Give it a shot

Changed March 24, 2013 03:14AM UTC by m_gol comment:2

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.

Changed March 24, 2013 03:23AM UTC by dcherman comment:3

_comment0: Is it possible for jQuery to be loading 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.1364095456214627

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.

Changed March 24, 2013 03:36AM UTC by mikesherov comment:4

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?

Changed March 24, 2013 03:46AM UTC by m_gol comment:5

OK, I'll try to write a test case.

Changed March 24, 2013 04:52AM UTC by m_gol comment:6

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

Changed March 25, 2013 02:32PM UTC by dmethvin comment:7

status: newopen
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.

Changed April 04, 2013 05:36PM UTC by Michał Gołębiowski comment:8

resolution: → fixed
status: openclosed

Fix #13655. Add test for jQuery.ready.promise fallback load. Close gh-1209.

Changeset: 32b066d3805a48f8c8312562ed52a1b5910b1d85