Closed
Bug 418214
Opened 17 years ago
Closed 17 years ago
[FIX]DOMParser modifies @style attribute when parsing a node in XHTML namespace
Categories
(Core :: XML, defect)
Core
XML
Tracking
()
RESOLVED
FIXED
People
(Reporter: sjoerdmulder, Assigned: bzbarsky)
References
Details
Attachments
(2 files)
2.25 KB,
text/html
|
Details | |
12.50 KB,
patch
|
peterv
:
review+
peterv
:
superreview+
mtschrep
:
approval1.9+
|
Details | Diff | Splinter Review |
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.12) Gecko/20080201 Firefox/2.0.0.12
Build Identifier:
Firefox seems to modify the style attribute when parsing XML. Because of this, it can’t be set using {} in XSLT. In the example attachted
Reproducible: Always
Steps to Reproduce:
1. Open the testcase
2. See the result from the parse / serialize in the textarea to be different
3. See how the middle box misses the red bottom-border
Actual Results:
Middle box misses the red bottom-border
Expected Results:
In Safari / Opera the testcase works as expected, all the 3 boxes should have a red bottom-border
Reporter | ||
Comment 1•17 years ago
|
||
Comment 2•17 years ago
|
||
What's happening is that we don't keep the source of the style attribute but parse it as CSS, |border-bottom: {$border}| is not valid CSS so it gets dropped. See also this warning in the console:
Warning: Error in parsing value for property 'border-bottom'. Declaration dropped.
Source File: https://bugzilla.mozilla.org/attachment.cgi?id=304017
Line: 0
Status: UNCONFIRMED → NEW
Ever confirmed: true
OS: Windows XP → All
Hardware: PC → All
Reporter | ||
Comment 3•17 years ago
|
||
Yes, i get that but when it's XML it should not parse the style attribute as CSS because the @style attribute doesnt mean anything (for XML)
Comment 4•17 years ago
|
||
(In reply to comment #3)
> Yes, i get that but when it's XML it should not parse the style attribute as
> CSS because the @style attribute doesnt mean anything (for XML)
But it means something for XHTML ;-). Not sure how to fix this without bloat for the majority of cases where we don't need the original attribute value.
Comment 5•17 years ago
|
||
Until modified every attribute should always retain its source specified value, including style=""... Doing otherwise sounds like a violation of the DOM.
Assignee | ||
Comment 6•17 years ago
|
||
> Until modified every attribute should always retain its source specified value,
We have an existing (possibly wontfix) bug on this. The memory bloat is a very real issue here. Note that there are lots of other DOM attributes that also get normalized.
For this particular case, I think one simple solution would be to not parse the style attribute if the document is a data document. In that case, we don't need the parsed value for anything. If the script adopts and then inserts the node into a non-data document, we'll reparse the attribute. If the script gets .style, we'll parse the attribute.
Assignee | ||
Comment 7•17 years ago
|
||
Assignee: nobody → bzbarsky
Status: NEW → ASSIGNED
Attachment #304058 -
Flags: superreview?(peterv)
Attachment #304058 -
Flags: review?(peterv)
Assignee | ||
Updated•17 years ago
|
Summary: DOMParser modifies @style attribute when parsing a node in XHTML namespace → [FIX]DOMParser modifies @style attribute when parsing a node in XHTML namespace
Comment 8•17 years ago
|
||
Comment on attachment 304058 [details] [diff] [review]
Like so, say
Sweet!
>+ * string. If aForce is true, will reparse even if we're in a data document.
s/aForce/aForceInDataDoc/
Attachment #304058 -
Flags: superreview?(peterv)
Attachment #304058 -
Flags: superreview+
Attachment #304058 -
Flags: review?(peterv)
Attachment #304058 -
Flags: review+
Assignee | ||
Comment 9•17 years ago
|
||
Comment on attachment 304058 [details] [diff] [review]
Like so, say
This should be pretty safe and help a number of scripting use cases.
Attachment #304058 -
Flags: approval1.9?
Updated•17 years ago
|
Attachment #304058 -
Flags: approval1.9? → approval1.9+
Assignee | ||
Comment 10•17 years ago
|
||
Checked in.
Status: ASSIGNED → RESOLVED
Closed: 17 years ago
Flags: in-testsuite+
Resolution: --- → FIXED
You need to log in
before you can comment on or make changes to this bug.
Description
•