Bug Tracker

Opened 12 years ago

Closed 12 years ago

Last modified 11 years ago

#9239 closed bug (fixed)

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

Change History (25)

comment:1 Changed 12 years ago by addyosmani

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.

comment:2 Changed 12 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 12 years ago by Timmy Willison

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/

comment:4 Changed 12 years ago by Timmy Willison

Status: reopenedopen

comment:5 Changed 12 years ago by Timmy Willison

#9242 is a duplicate of this ticket.

comment:6 Changed 12 years ago by Timmy Willison

#9257 is a duplicate of this ticket.

comment:7 Changed 12 years ago by Timmy Willison

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

comment:8 Changed 12 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 12 years ago by Aderty (previous) (diff)

comment:9 Changed 12 years ago by jaubourg

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

comment:10 Changed 12 years ago by Timmy Willison

#9366 is a duplicate of this ticket.

comment:11 Changed 12 years ago by Timmy Willison

#9420 is a duplicate of this ticket.

comment:12 Changed 12 years ago by Timmy Willison

#9450 is a duplicate of this ticket.

comment:13 Changed 12 years ago by anonymous

This bug still seems present in 1.6.1 with IE8.

comment:14 in reply to:  13 Changed 12 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 12 years ago by anonymous

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

comment:16 Changed 12 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 12 years ago by Timmy Willison

#9581 is a duplicate of this ticket.

comment:18 Changed 12 years ago by Timmy Willison

#9606 is a duplicate of this ticket.

comment:19 Changed 12 years ago by Timmy Willison

#9636 is a duplicate of this ticket.

comment:20 Changed 12 years ago by Timmy Willison

#9640 is a duplicate of this ticket.

comment:21 Changed 12 years ago by addyosmani

#9652 is a duplicate of this ticket.

comment:22 Changed 12 years ago by dmethvin

#9669 is a duplicate of this ticket.

comment:23 Changed 12 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 12 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 11 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.