Skip to main content

Bug Tracker

Side navigation

#5579 closed bug (wontfix)

Opened December 02, 2009 12:42AM UTC

Closed October 21, 2010 01:44AM UTC

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>

Attachments (0)
Change History (6)

Changed December 03, 2009 01:28AM UTC by dmethvin comment:1

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.

Changed December 08, 2009 04:02PM UTC by replaid comment:2

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!

Changed June 13, 2010 07:06PM UTC by dmethvin comment:3

component: unfiledsupport

line 3204 is in jQuery.support

Changed August 09, 2010 02:02AM UTC by dmethvin comment:4

Hmmm, perhaps we could use document.getElementsByTagName(‘body’)[0] instead?

Changed September 27, 2010 01:42AM UTC by dmethvin comment:5

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).

Changed October 21, 2010 01:44AM UTC by snover comment:6

resolution: → wontfix
status: newclosed

Don’t use DOM keywords as names for your frames.