Bug Tracker

Modify

Ticket #6018 (closed bug: worksforme)

Opened 4 years ago

Last modified 21 months ago

document.body is null or not a object

Reported by: sgurusam Owned by:
Priority: major Milestone: 1.4.2
Component: event Version: 1.3.2
Keywords: Cc: sivag@…
Blocking: Blocked by:

Description

Line 3205: jquery-1.3.2.js throws 'document.body is null' for following usecase

  1. Load site which has jquery-1.3.2.js in IE or FireFox
  2. Before loading previous site, try to load any other site say google.com.
  3. document.body is null error appears in console
  4. Google.com loads fine

This issue is not show stopper but unnecessary alert is appearing which is giving a wrong impression to user.

jQuery(function() {

var div = document.createElement("div"); div.style.width = div.style.paddingLeft = "1px";

document.body.appendChild( div );

jQuery.boxModel = jQuery.support.boxModel = div.offsetWidth === 2;

Line 3205: document.body.removeChild( div ).style.display = 'none';

div = null;

});

Attachments

jquery_document_null.JPG Download (19.3 KB) - added by sgurusam 4 years ago.
IE script error dialog

Change History

Changed 4 years ago by sgurusam

IE script error dialog

comment:1 Changed 4 years ago by john

  • Status changed from new to closed
  • Resolution set to worksforme
  • Component changed from unfilled to event

This was fixed in jQuery 1.4 (document.body is guaranteed to exist before the ready even fires, at minimum).

comment:2 in reply to: ↑ description Changed 21 months ago by anonymous

Replying to sgurusam:

Line 23004: jquery-1.3.2.js throws 'document.body is null' for following usecase

  1. Load site which has jquery-1.3.2.js in IE or FireFox
  2. Before loading previous site, try to load any other site say google.com.
  3. document.body is null error appears in console
  4. Google.com loads fine

This issue is not show stopper but unnecessary alert is appearing which is giving a wrong impression to user.

var submitButton;

$(document).ready(function() {

submitButton = $("#cmdSubmit");

});

NOTE that calling $("form:first").submit() seems to bypass ASP.NET MVC's ajax stuff and submit the whole page which we don't want window.setInterval( function() {submitButton.click();}, <% Response.Write(ViewData.Model.UpdatePanelRefreshRate.ToString()); %>);

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.