document.bgColor setting has no effect if body not created

RESOLVED INVALID

Status

()

RESOLVED INVALID
14 years ago
9 years ago

People

(Reporter: Luineancaion, Unassigned)

Tracking

Trunk
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment)

(Reporter)

Description

14 years ago
User-Agent:       Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.1) Gecko/20040802
Build Identifier: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.1) Gecko/20040802

Seems that you need to put a line such as document.write('blah'); above
document.bgColor = 'red'; before it will work.

Reproducible: Always
Steps to Reproduce:
<html>
	<head>
		<title>This is a java script page</title>
			<script language="JavaScript">
			<!--
			alert('My first JavaScript program!');
			document.write(',');
			document.bgColor = 'red';
			document.write("My text goes here!");
			//-->
			</script>
	</head>
		<body>
			This is the body
		</body>
</html>
Actual Results:  
That works until the line above document.bgColor = 'red'; is removed

Expected Results:  
Should work without that line.
Created attachment 159259 [details]
testcase

note: setting bgColor from onload works just fine, as does setting it from link
click
dbaron's comment in
http://lxr.mozilla.org/seamonkey/source/content/html/document/src/nsHTMLDocument.cpp#2710
seems to be exactly the case here: alert(document.body) alerts null in this
testcase (when put before the document.bgColor setting); and it alerts [object
HTMLBodyElement] if put after a document.write.

could this code just create the body element in such a case?
Assignee: general → general
Status: UNCONFIRMED → NEW
Component: Browser-General → DOM: HTML
Ever confirmed: true
QA Contact: general → ian
Summary: javascript document.bgColor = → document.bgColor setting has no effect if body not created
> could this code just create the body element in such a case?

Not without majorly confusing the content sink if this is done during parsing.

Updated

11 years ago
Component: DOM: HTML → DOM: Core & HTML
QA Contact: ian → general
We match HTML5 here. See <http://www.whatwg.org/html5/#dom-document-bgcolor>.
Status: NEW → RESOLVED
Last Resolved: 9 years ago
Resolution: --- → INVALID
You need to log in before you can comment on or make changes to this bug.