Bug Tracker

Modify

Ticket #5579 (closed bug: wontfix)

Opened 4 years ago

Last modified 3 years ago

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:
Blocking: Blocked by:

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

comment:1 Changed 4 years ago by dmethvin

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.

comment:2 Changed 4 years ago by replaid

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:3 Changed 3 years ago by dmethvin

  • Component changed from unfiled to support

line 3204 is in jQuery.support

comment:4 Changed 3 years ago by dmethvin

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

comment:5 Changed 3 years ago by dmethvin

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 3 years ago by snover

  • Status changed from new to closed
  • Resolution set to wontfix

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

Please follow the  bug reporting guidlines and use  jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

View

Add a comment

Modify Ticket

Action
as closed
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.