Closed Bug 103095 Opened 24 years ago Closed 24 years ago

innerHTML of XHTML document spurious attribute /=""

Categories

(Core :: DOM: Core & HTML, defect, P3)

x86
Windows 98
defect

Tracking

()

VERIFIED FIXED
mozilla0.9.7

People

(Reporter: jim, Assigned: harishd)

References

()

Details

(Keywords: testcase, Whiteboard: [fix in hand])

Attachments

(2 files)

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.
Harish, does the html parser not properly deal with short tags (i.e. <p/>)?
Assignee: jst → harishd
Attached testcase to the bug since the URL apparently no longer works. Confirmed bug on win2k Mozilla 0.9.5. Marking NEW.
Status: UNCONFIRMED → NEW
Ever confirmed: true
Keywords: testcase
I'll fix the url on monday, not sure how it could've disappeared.
Status: NEW → ASSIGNED
Priority: -- → P3
Whiteboard: [fix in hand]
Target Milestone: --- → mozilla0.9.7
FIXED.
Status: ASSIGNED → RESOLVED
Closed: 24 years ago
Resolution: --- → FIXED
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 → ---
That fixes things, but could you not just do: isUsableAttr = mFlags & NS_IPARSER_FLAG_VIEW_SOURCE; // Fix bug 103095 without the "?:" stuff?
yes you could....
Status: REOPENED → ASSIGNED
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 on attachment 61335 [details] [diff] [review] patch v1.1 [ make sure to display forward slash in viewsource ] sr=jband
Attachment #61335 - Flags: superreview+
FIXED..again!
Status: ASSIGNED → RESOLVED
Closed: 24 years ago24 years ago
Resolution: --- → FIXED
*** Bug 83939 has been marked as a duplicate of this bug. ***
QA Contact: lchiang → ian
v per testcase
Status: RESOLVED → VERIFIED
Component: DOM: Mozilla Extensions → DOM
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: