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)

defect
Not set
normal

Tracking

()

RESOLVED INVALID

People

(Reporter: Luineancaion, Unassigned)

Details

Attachments

(1 file)

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.
Attached file 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.
Component: DOM: HTML → DOM: Core & HTML
QA Contact: ian → general
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.

Attachment

General

Created:
Updated:
Size: