innerHTML ignores style= CSS attributes




DOM: Core & HTML
18 years ago
17 years ago


(Reporter: djoham, Assigned: jst)



Firefox Tracking Flags

(Not tracked)



(1 attachment)

955 bytes, text/html


18 years ago
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux 2.2.17-21mdk i686; en-US; m18) Gecko/20010103
BuildID:    2001010306

In a recent build (starting while I was gone for the holidays) innerHTML stopped
honoring the style=XXXX CSS properties for the form elements being inserted.

Reproducible: Always
Steps to Reproduce:
1.Open the test case I'll submit on the top button, this button uses style= it will not work as expected on the second button. This button uses class= in the innerHTML. It works
as I would expect	

Actual Results:  the two buttons produce different results.

Expected Results:  The two buttons produce different results. They should
produce identical results.		

This recreation is done with the "quirks" mode turned on (ie only using the HTML
tag). When I use the strict DTD, mozilla really horks the rendering of the page
up. The text box is placed directly over the top button and the page is not
reflowed at all. Since innerHTML is not really a DOM standard, I'm wondering if
this is expected or not. Should I log a different bug on this?

Comment 1

18 years ago
Created attachment 22054 [details]
test case

Comment 2

18 years ago
So clicking on either button should generate a text field with the word "worky"
in the field and colored green, correct?

Comment 3

18 years ago
oops, no, sorry. Only the placement and the text color of the text box should be 
the same. The actual text values will be different. My bad.


Comment 4

18 years ago
I am seeing this with build 2001010508 using Mac OS 9.0.4.  Changing platform
and os to reflect this.
OS: Linux → All
Hardware: PC → All

Comment 5

18 years ago
I see this on Linux 2001010516.

Comment 6

18 years ago
Ok, I found the problem, it was a regression I had caused in my earlier content
code cleanup, SetDocument on a formcontrol was calling
nsGenericElement::SetDocument() and not nsGenericHTMLElement::SetDocument() so
parsing of style attributes didn't happen when the elemenet was added to the
document. Marking FIXED.
Last Resolved: 18 years ago
Resolution: --- → FIXED

Comment 7

18 years ago
Both buttons produce the green text and done dialog window in my latest linux
build from the tip. Verified on this platform.

Comment 8

18 years ago
Damn, if only I could get a response like this on my other bugs.

Thanks for the great response everyone. Kudos!


Comment 9

17 years ago
Verified with 2001-02-06-08-Mtrunk on win-95.
You need to log in before you can comment on or make changes to this bug.