Skip to main content

Bug Tracker

Side navigation

#12754 closed bug (patchwelcome)

Opened October 17, 2012 11:53AM UTC

Closed October 17, 2012 05:19PM UTC

jQuery.load() can render the page useless in IE7

Reported by: enkidude@gmail.com Owned by:
Priority: low Milestone: 1.next
Component: ajax Version: 1.8.2
Keywords: Cc:
Blocked by: Blocking:
Description

jQuery.load() can render the page useless in IE7


In IE7 (and maybe IE8) using jQuery.load() with a selector can under certain circumstances render the page useless (blank). It's some sort of race condition and happens if jQuery.load() is called multiple times under a short period of time. The pages that are loaded have to contain a CSS @font-face rule (inline or link) with a src attribute (but the actual font file does not have to exist). Furthermore, the loaded pages have to be of a certain size/complexity for this bug to be triggered.

When the bug is triggered the page will freeze and if the browser window is resized the page goes blank. When using IE developer toolbar to inspect the elements all content has been loaded into the DOM as expected.

I've created a page in JS Bin that reproduces the problem. If the bug is not triggered in IE7 the number of jQuery.load() request might have to be increased or the page that is loaded might be too small. It is possible to modify either page in JS Bin.

Page that reproduces the bug:

http://jsbin.com/jquery_load_ie7_bug_test_case/1/

The page that is loaded using jQuery.load():

http://jsbin.com/jquery_load_ie7_bug_page_to_load/1/

jQuery version: 1.8.2

affected browser: IE7 (and maybe IE8)

Attachments (0)
Change History (5)

Changed October 17, 2012 03:02PM UTC by timmywil comment:1

component: unfiledajax
milestone: None1.next
priority: undecidedlow
status: newopen

Maybe we should clear font-face declarations in .load.

Changed October 17, 2012 03:36PM UTC by enkidude@gmail.com comment:2

Replying to [comment:1 timmywil]:

Maybe we should clear font-face declarations in .load.

Please remember that the problem occurs both when font-face is declared in <style> elements as well as in externa CSS-files.

Changed October 17, 2012 03:52PM UTC by jaubourg comment:3

Sounds like a can of worms we don't wanna open in core.

Isn't there any reasonable workaround for user code here?

Changed October 17, 2012 04:07PM UTC by enkidude@gmail.com comment:4

Would it be possible to strip all <style> and <link> elements in the same way as <script> elements are removed?

Changed October 17, 2012 05:19PM UTC by jaubourg comment:5

resolution: → patchwelcome
status: openclosed

Well, the problem is that the entire HTML string is added to a detached node from the host document before selecting (that way, we don't need to actually parse the HTML string). So the stylesheet is inserted and, somehow, IE starts loading CSS-related resources that are referenced inside other nodes (through a classname). Then the style/link node is discarded and IE pretty much crashes. I already saw that happen in IE8 when we had the secondary body for support tests. When there was a background-image attached to the body using some CSS rule, IE8 would act erractically when this body would be removed.

Removing style and link nodes won't work and may even be undesirable. What if the style node is in the selected fragment?

I'll close this as patch-welcome but I doubt we will see a reasonable solution to this.