Side navigation
#4230 closed bug (fixed)
Opened February 24, 2009 02:33PM UTC
Closed March 02, 2009 12:26AM UTC
Last modified March 02, 2009 12:28AM UTC
$('<link/>').attr crashes IE8rc1
Reported by: | yoursunny | Owned by: | |
---|---|---|---|
Priority: | major | Milestone: | 1.4 |
Component: | core | Version: | 1.3.2 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
I'm running IE8rc1 (en-us) on Windows Server 2003 (zh-cn), and I'm using jQuery version 1.3.2.
I'm inserting a stylesheet into the HTML page, but iexplore.exe Tab-process crashes every time. The code is in the attachment.
After reading through the source code of jQuery, I found that jQuery is injecting the <link/> tag into a <div/>, which is not allowed by W3C standards. <link/> should only appear in <head/>, but <div/> appears in <body/>. It seems that jQuery's illegal operation causes IE8rc1 to crash when attr() is called.
Please also see the related post in IE newsgroup: http://tinyurl.com/aq7zyu , and the bug in IE's tracker: http://tinyurl.com/bbh5ks .
Attachments (2)
Change History (3)
Changed February 24, 2009 02:41PM UTC by comment:1
Changed March 02, 2009 12:26AM UTC by comment:2
resolution: | → fixed |
---|---|
status: | new → closed |
I've updated the documentation to clarify that the HTML is parsed using a div, and therefore can't contain elements that are not valid in a div.
http://docs.jquery.com/Core/jQuery#htmlownerDocument
Let's hope that IE8 fixes the crash with the released version.
Changed March 02, 2009 12:28AM UTC by comment:3
Also, if you create the element using
$("<link />")and add the attrs afterwards, that may work with IE8 because that case uses document.createElement.
The jQuery code causing IE to crash is:
$('<link rel="stylesheet" type="text/css"/>').attr('href','http://css.cn.msn.com/c/green14.css');
It is equivalent to the DOM2 code in DOM2-IEcrash.htm