Bug Tracker

Ticket #9239 (closed bug: fixed)

Opened 3 years ago

Last modified 2 years ago

Version 1.6.0 breaks the background behavior on body element

Reported by: Golmote Owned by:
Priority: blocker Milestone: 1.6.2
Component: support Version: 1.6
Keywords: Cc:
Blocking: Blocked by:

Description

I encounter a really weird bug with version 1.6.0 on Opera 11.01 on Mac OS X

Just compare these two code snippets :

<!DOCTYPE HTML>
<html lang="fr">
	<head>
		<style type="text/css">
			body { background: red; }
		</style>
	</head>
	<body>	
		<div>Some content</div>
		<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.5.2/jquery.min.js"></script>
	</body>
</html>
<!DOCTYPE HTML>
<html lang="fr">
	<head>
		<style type="text/css">
			body { background: red; }
		</style>
	</head>
	<body>	
		<div>Some content</div>
		<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.0/jquery.min.js"></script>
	</body>
</html>

In the second case, the background color is strangely limited to the content...

Change History

comment:1 Changed 3 years ago by addyosmani

  • Priority changed from undecided to low
  • Resolution set to worksforme
  • Status changed from new to closed
  • Component changed from unfiled to misc

Thanks for submitting a ticket to the jQuery Project. I've recreated your test cases here:  http://jsfiddle.net/9vAFE/show/ (1.6) and  http://jsfiddle.net/9vAFE/show/1 (for 1.5.2) and tested using Opera 11.01 on OSX. Both tests result in the same output with no visible differences. We will be closing this ticket but if this issue persists, please feel free to supply an additional test case that reproduces the issue and we'll re-evaluate.

comment:2 Changed 3 years ago by Golmote

Thanks for your answer.

I couldn't see any differences between the two jsFiddle test cases... So I compared my local code with the code generated by jsFiddle, and the bug gets weirder... it seems to happen only when the jQuery script is included in the <body>. Included in the <head> element, the problem doesn't occur.

I can't find any option to force jsFiddle so that it puts the JS at the end of the body... =/

Here are two test cases :

 http://golmote.free.fr/jq6opera-head.html <-- This one works great

 http://golmote.free.fr/jq6opera-body.html <-- This one doesn't

Again, I'm seeing the bug with Opera 11.01 on Mac OSX.

Thanks.

comment:3 Changed 3 years ago by timmywil

  • Priority changed from low to blocker
  • Resolution worksforme deleted
  • Status changed from closed to reopened
  • Component changed from misc to support
  • Milestone changed from 1.next to 1.6.2

This probably has something to do with the support mock body:  http://jsfiddle.net/timmywil/9vAFE/4/show/

comment:4 Changed 3 years ago by timmywil

  • Status changed from reopened to open

comment:5 Changed 3 years ago by timmywil

#9242 is a duplicate of this ticket.

comment:6 Changed 3 years ago by timmywil

#9257 is a duplicate of this ticket.

comment:7 Changed 3 years ago by timmywil

  • Summary changed from Version 1.6.0 breaks the background-color behavior on body element to Version 1.6.0 breaks the background behavior on body element

IE8 as well

comment:8 Changed 3 years ago by Aderty

Same problem on version 1.6.1

The bug can be resolved on ligne 1288 from jquery-1.6.1.js.

Replace :

"documentElement.insertBefore( body, documentElement.firstChild );"

by

"documentElement.appendChild( body );"

Last edited 3 years ago by Aderty (previous) (diff)

comment:9 Changed 3 years ago by jaubourg

  • Status changed from open to closed
  • Resolution set to fixed

Fixes #9239. If the body is already present in the DOM, use a div within it to perform boxModel-related support tests. Unit test added.

Changeset: ceba855c010c792aad8fc15edc06b86285f71142

comment:10 Changed 3 years ago by timmywil

#9366 is a duplicate of this ticket.

comment:11 Changed 3 years ago by timmywil

#9420 is a duplicate of this ticket.

comment:12 Changed 3 years ago by timmywil

#9450 is a duplicate of this ticket.

comment:13 follow-up: ↓ 14 Changed 3 years ago by anonymous

This bug still seems present in 1.6.1 with IE8.

comment:14 in reply to: ↑ 13 Changed 3 years ago by irideas

Replying to anonymous:

This bug still seems present in 1.6.1 with IE8.

yes ,with IE8 standard mode.

comment:15 Changed 3 years ago by anonymous

I also can confirm this bug is still present in 1.6.1 with IE8 standard mode.

comment:16 Changed 3 years ago by dmethvin

The commit was made on May 13, but jQuery 1.6.1 was released on May 12. So yes, this problem is in 1.6.1 but should be fixed in 1.6.2 when it is released. The release will be announced in the blog.

comment:17 Changed 3 years ago by timmywil

#9581 is a duplicate of this ticket.

comment:18 Changed 3 years ago by timmywil

#9606 is a duplicate of this ticket.

comment:19 Changed 3 years ago by timmywil

#9636 is a duplicate of this ticket.

comment:20 Changed 3 years ago by timmywil

#9640 is a duplicate of this ticket.

comment:21 Changed 3 years ago by addyosmani

#9652 is a duplicate of this ticket.

comment:22 Changed 3 years ago by dmethvin

#9669 is a duplicate of this ticket.

comment:23 Changed 3 years ago by anonymous

Problem still appears to be present in 1.6.4 with Opera 9.5 on Windows Mobile 6.5.

If jquery is included in the <head> then no css background color is applied to the body. However if jquery is included in the <body> then css background color is applied to the body as expected.

In 1.6.4 replacing line 1299:

testElement = document.createElement( body ? "div" : "body" );

with

testElement = document.createElement( body ? "div" : "div" );

fixes this behavior, but it's hardly a fix.

Not sure on your policy for supporting older browsers so I understand that this may not get addressed, but thought it worth letting you know since it's taken me a while to track this down (javascript is not one of my strengths).

comment:24 Changed 3 years ago by manuelc

jQuery 1.6.4 still has this issue. I can reproduce the bug using the last Opera version. The proposed workaround from comment:23 seems to have side effects.

comment:25 Changed 3 years ago by andr3ws

Use http://bugs.jquery.com/ticket/9239#comment:23 to fix this. Works without side effects.

Note: See TracTickets for help on using tickets.