Closed
Bug 103095
Opened 24 years ago
Closed 24 years ago
innerHTML of XHTML document spurious attribute /=""
Categories
(Core :: DOM: Core & HTML, defect, P3)
Tracking
()
VERIFIED
FIXED
mozilla0.9.7
People
(Reporter: jim, Assigned: harishd)
References
()
Details
(Keywords: testcase, Whiteboard: [fix in hand])
Attachments
(2 files)
|
557 bytes,
text/html
|
Details | |
|
759 bytes,
patch
|
peterv
:
review+
jband_mozilla
:
superreview+
|
Details | Diff | Splinter Review |
If you create an XHTML page, (sent as text/html, or local file) then innerHTML
serialises it as something other than XHTML (fair enough.) However if you then
modify the document to include some further XHTML using innerHTML, the
resulting element has a spurious attribute /=""
This can be seen with:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0
Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Test Page</title>
</head>
<body>
<p id="moomin"><img src="something.invalid" alt="image" /></p>
<script>
window.onload=onl
function onl() {
alert(document.getElementById('moomin').innerHTML)
document.getElementById('moomin').innerHTML=
'<img src="something.invalid" alt="image" />'
alert(document.getElementById('moomin').innerHTML)
}
</script>
</body>
</html>
(available at the URL.)
Not a serious bug, but definately unexpected behaviour and could cause
scripting issues.
Comment 1•24 years ago
|
||
Harish, does the html parser not properly deal with short tags (i.e. <p/>)?
Assignee: jst → harishd
Comment 2•24 years ago
|
||
Comment 3•24 years ago
|
||
Attached testcase to the bug since the URL apparently no longer works. Confirmed
bug on win2k Mozilla 0.9.5. Marking NEW.
I'll fix the url on monday, not sure how it could've disappeared.
Patch ( http://bugzilla.mozilla.org/showattachment.cgi?attach_id=56581 ) in bug
108373 should fix the problem.
Status: NEW → ASSIGNED
Priority: -- → P3
Whiteboard: [fix in hand]
Target Milestone: --- → mozilla0.9.7
FIXED.
Status: ASSIGNED → RESOLVED
Closed: 24 years ago
Resolution: --- → FIXED
Comment 7•24 years ago
|
||
Hmm... This fix causes view source to not show the "/" for empty tags....
Harish, is there any way to detect when the source had a "/" short of having an
attribute node for it?
doh!. It shouldn't be too hard. Reopening to fix the viewsource problem.
Thanx for the heads up Boris.
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
Comment 10•24 years ago
|
||
That fixes things, but could you not just do:
isUsableAttr = mFlags & NS_IPARSER_FLAG_VIEW_SOURCE; // Fix bug 103095
without the "?:" stuff?
Comment 12•24 years ago
|
||
Comment on attachment 61335 [details] [diff] [review]
patch v1.1 [ make sure to display forward slash in viewsource ]
r=peterv.
Attachment #61335 -
Flags: review+
Comment 13•24 years ago
|
||
Comment on attachment 61335 [details] [diff] [review]
patch v1.1 [ make sure to display forward slash in viewsource ]
sr=jband
Attachment #61335 -
Flags: superreview+
| Assignee | ||
Comment 14•24 years ago
|
||
FIXED..again!
Status: ASSIGNED → RESOLVED
Closed: 24 years ago → 24 years ago
Resolution: --- → FIXED
| Assignee | ||
Comment 15•24 years ago
|
||
*** Bug 83939 has been marked as a duplicate of this bug. ***
Updated•13 years ago
|
Component: DOM: Mozilla Extensions → DOM
Updated•7 years ago
|
Component: DOM → DOM: Core & HTML
You need to log in
before you can comment on or make changes to this bug.
Description
•