Closed
Bug 605157
Opened 15 years ago
Closed 15 years ago
Style tags are ignored in innerHTML in XML
Categories
(Core :: XML, defect, P1)
Core
XML
Tracking
()
RESOLVED
FIXED
mozilla2.0b7
| Tracking | Status | |
|---|---|---|
| blocking2.0 | --- | final+ |
People
(Reporter: lorchard, Assigned: bzbarsky)
References
Details
Attachments
(1 file, 2 obsolete files)
Filing this bug from the discussion in bug 592431. The original issue was that I couldn't get CSS in <style> elements to take effect.
| Reporter | ||
Comment 1•15 years ago
|
||
Attaching a patch that seems to fix the problem for me, but also switches the snippet loading process from using innerHTML to the importNode DOM method. Not sure if that's what should be done or not, but it seems to fix the problem.
| Assignee | ||
Updated•15 years ago
|
Component: General → XML
Priority: -- → P1
Product: Firefox → Core
QA Contact: general → xml
Summary: Style tags are ignored in about:home snippets → Style tags are ignored in innerHTML in XML
| Assignee | ||
Comment 2•15 years ago
|
||
| Assignee | ||
Comment 3•15 years ago
|
||
Comment on attachment 484023 [details] [diff] [review]
Style linking elements should work in XML when set via innerHTML.
I could also hack this in the fragment sink, but this seems like the right thing to me.
The only question is whether the SetLineNumber thing should also be if aFromParser.
Attachment #484023 -
Flags: review?(jonas)
| Assignee | ||
Updated•15 years ago
|
Whiteboard: [need review]
| Reporter | ||
Comment 4•15 years ago
|
||
Possibly related to this is bug 594989 - that is, JS in <script> tags from HTML injected via innerHTML are also ignored. Is that also a bug?
Comment 5•15 years ago
|
||
Actually, we are not setting innerHTML to document.head like in the reftest here but in a div in body, is that what we should do instead? (so after innerHTLM just remove the <style> from body and add it to head?)
Our case is more like document.getElementById("some_div").innerHTML = "<span id="some_span>test</span><style>#some_span { color: green; }</style>";
Yeah, I suspect setting the initial line number to 0 is the best thing we can do when parsing a fragment.
| Assignee | ||
Comment 7•15 years ago
|
||
> JS in <script> tags from HTML injected via innerHTML are also ignored.
That's required by both web compat and the HTML5 spec.
> is that what we should do instead?
Doesn't matter; I just did it that way in the reftest because it let me use a minimal number of tags.
> I suspect setting the initial line number to 0 is the best thing we can do
Sure; but do you want to do that explicitly, or assume that the fragment parser is already handling that?
Can't aLineNumber be != 0 during fragment parsing there? I.e. won't it be the line number within the fragment? If it's always 0 I don't really care much, especially if we have a test.
Comment on attachment 484023 [details] [diff] [review]
Style linking elements should work in XML when set via innerHTML.
r=me if you either include a test, or explicitly do
SetLineNumber(aFromParser ? aLineNumber : 0)
(don't know how hard it is to test the set line number from the page)
Attachment #484023 -
Flags: review?(jonas) → review+
| Assignee | ||
Comment 11•15 years ago
|
||
> (don't know how hard it is to test the set line number from the page)
Impossible, modulo use of UniversalXPConnect.
I can do the explicit set to 0, or I do what the html fragment sink does and not set at all (defaults to 1). Preferences?
explicit seems nicer
Updated•15 years ago
|
Attachment #483996 -
Attachment is obsolete: true
Updated•15 years ago
|
Assignee: nobody → bzbarsky
Status: NEW → ASSIGNED
Whiteboard: [need review] → [needs updated patch]
| Assignee | ||
Updated•15 years ago
|
Attachment #484023 -
Attachment is obsolete: true
| Assignee | ||
Comment 13•15 years ago
|
||
| Assignee | ||
Updated•15 years ago
|
Whiteboard: [needs updated patch] → [needs landing]
| Assignee | ||
Comment 14•15 years ago
|
||
Status: ASSIGNED → RESOLVED
Closed: 15 years ago
Flags: in-testsuite+
Resolution: --- → FIXED
Whiteboard: [needs landing]
Target Milestone: --- → mozilla2.0b8
| Assignee | ||
Updated•15 years ago
|
Target Milestone: mozilla2.0b8 → mozilla2.0b7
You need to log in
before you can comment on or make changes to this bug.
Description
•