Closed
Bug 259949
Opened 21 years ago
Closed 15 years ago
document.bgColor setting has no effect if body not created
Categories
(Core :: DOM: Core & HTML, defect)
Core
DOM: Core & HTML
Tracking
()
RESOLVED
INVALID
People
(Reporter: Luineancaion, Unassigned)
Details
Attachments
(1 file)
175 bytes,
text/html
|
Details |
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.
Comment 1•21 years ago
|
||
note: setting bgColor from onload works just fine, as does setting it from link
click
Comment 2•21 years ago
|
||
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
A more permanent URL for that is:
http://bonsai.mozilla.org/cvsblame.cgi?file=mozilla/content/html/document/src/nsHTMLDocument.cpp&rev=3.583&mark=2718#2710
![]() |
||
Comment 4•21 years ago
|
||
> 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.
Comment 5•15 years ago
|
||
We match HTML5 here. See <http://www.whatwg.org/html5/#dom-document-bgcolor>.
Status: NEW → RESOLVED
Closed: 15 years ago
Resolution: --- → INVALID
You need to log in
before you can comment on or make changes to this bug.
Description
•