Opened 13 years ago
Closed 12 years ago
#5579 closed bug (wontfix)
iframe with name="body" blows up at ready() time
Reported by: | replaid | Owned by: | |
---|---|---|---|
Priority: | major | Milestone: | 1.4 |
Component: | support | Version: | 1.3.2 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
The following HTML page throws a script error in Safari 4.0.3. If a ready() function is added it will not run.
The error message is: TypeError: Result of expression 'document.body.appendChild' [undefined] is not a function. ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.js:3204
Here's the smallest HTML code to reproduce the problem:
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.js"></script> <iframe name="body"></iframe>
Change History (6)
comment:1 Changed 13 years ago by
comment:2 Changed 13 years ago by
I agree with dmethvin's comment, except that I think jQuery should at least be able to operate in that situation. Right now it can't run any $(document).ready()
functions at all if such a frame exists!
comment:4 Changed 13 years ago by
Hmmm, perhaps we could use document.getElementsByTagName(‘body’)[0] instead?
comment:5 Changed 12 years ago by
Looking at all the places where we use document.body (8 locations currently), maybe it should be in a closure variable and jQuery.ready could set it. Otherwise it's not worth fixing this since it will break elsewhere (for example, a $("body") selector).
comment:6 Changed 12 years ago by
Resolution: | → wontfix |
---|---|
Status: | new → closed |
Don’t use DOM keywords as names for your frames.
This might be a manifestation of the problem seen in #3113 with forms. The expression
document.body
becomes ambiguous and either refers to the body element or the iframe with a name of "body". Not sure if jQuery can do anything about it though.