Skip to main content

Bug Tracker

Side navigation

#9239 closed bug (fixed)

Opened May 11, 2011 02:30PM UTC

Closed May 13, 2011 03:45PM UTC

Last modified March 17, 2012 08:54PM UTC

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

Attachments (0)
Change History (25)

Changed May 11, 2011 04:49PM UTC by addyosmani comment:1

component: unfiledmisc
priority: undecidedlow
resolution: → worksforme
status: newclosed

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.

Changed May 12, 2011 08:18AM UTC by Golmote comment:2

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.

Changed May 12, 2011 02:38PM UTC by timmywil comment:3

component: miscsupport
milestone: 1.next1.6.2
priority: lowblocker
resolution: worksforme
status: closedreopened

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

Changed May 12, 2011 02:39PM UTC by timmywil comment:4

status: reopenedopen

Changed May 12, 2011 04:21PM UTC by timmywil comment:5

#9242 is a duplicate of this ticket.

Changed May 12, 2011 04:23PM UTC by timmywil comment:6

#9257 is a duplicate of this ticket.

Changed May 12, 2011 04:23PM UTC by timmywil comment:7

summary: Version 1.6.0 breaks the background-color behavior on body elementVersion 1.6.0 breaks the background behavior on body element

IE8 as well

Changed May 13, 2011 01:55PM UTC by Aderty comment:8

_comment0: 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 );1305295058983252

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 );"

Changed May 13, 2011 03:45PM UTC by jaubourg comment:9

resolution: → fixed
status: openclosed

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

Changed May 24, 2011 01:28AM UTC by timmywil comment:10

#9366 is a duplicate of this ticket.

Changed May 25, 2011 03:27PM UTC by timmywil comment:11

#9420 is a duplicate of this ticket.

Changed May 28, 2011 04:10PM UTC by timmywil comment:12

#9450 is a duplicate of this ticket.

Changed June 06, 2011 10:56PM UTC by anonymous comment:13

This bug still seems present in 1.6.1 with IE8.

Changed June 09, 2011 07:16AM UTC by irideas comment:14

Replying to [comment:13 anonymous]:

This bug still seems present in 1.6.1 with IE8.

yes ,with IE8 standard mode.

Changed June 09, 2011 11:49AM UTC by anonymous comment:15

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

Changed June 09, 2011 03:43PM UTC by dmethvin comment:16

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.

Changed June 14, 2011 02:00PM UTC by timmywil comment:17

#9581 is a duplicate of this ticket.

Changed June 17, 2011 01:14PM UTC by timmywil comment:18

#9606 is a duplicate of this ticket.

Changed June 21, 2011 05:15PM UTC by timmywil comment:19

#9636 is a duplicate of this ticket.

Changed June 21, 2011 06:39PM UTC by timmywil comment:20

#9640 is a duplicate of this ticket.

Changed June 23, 2011 06:04AM UTC by addyosmani comment:21

#9652 is a duplicate of this ticket.

Changed June 25, 2011 01:38PM UTC by dmethvin comment:22

#9669 is a duplicate of this ticket.

Changed September 15, 2011 12:12AM UTC by anonymous comment:23

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

Changed September 28, 2011 03:38PM UTC by manuelc comment:24

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.

Changed February 16, 2012 07:03AM UTC by andr3ws comment:25

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