Open
Bug 1507849
Opened 6 years ago
Updated 2 years ago
The type of template contents owner document is incorrect on XHTML documents
Categories
(Core :: DOM: Core & HTML, defect, P3)
Tracking
()
NEW
People
(Reporter: david.rivron, Unassigned)
Details
User Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:63.0) Gecko/20100101 Firefox/63.0
Steps to reproduce:
On a XHTML document :
document.createElement('template').content.ownerDocument.contentType
Actual results:
The content type is "text/html" which is incorrect. The assignment of innerHTML on the template will parse as HTML, not as XHTML.
Expected results:
The template contents owner document should be of the same type of the template owner document. Chrome, Edge ansd Safari have a correct behavior.
Updated•6 years ago
|
Component: Untriaged → DOM
Product: Firefox → Core
Comment 1•6 years ago
|
||
Per the HTML Standard this should always be "application/xml", even if the document is marked as HTML (as that doesn't affect this field). Added a comment to https://github.com/whatwg/html/issues/2109 to ensure this gets tested.
The bigger issue here though is that it's type (which isn't exposed by contentType) is not XML.
Status: UNCONFIRMED → NEW
Ever confirmed: true
Priority: -- → P3
Reporter | ||
Comment 2•6 years ago
|
||
> which isn't exposed by contentType
I don't know any other way to inspect the 'type' of a document.
> Per the HTML Standard this should always be "application/xml", even if the document is marked as HTML (as that doesn't affect this field).
Do you say that the template contents owner document (tcod) should be 'application/xml' even if the host document (and therefore the tcod) uses the HTML syntax ?
Chrome and Safari return "application/xml" but Edge returns "application/xhtml+xml" for the tcod on a host document served with "application/xhtml+xml".
All use the HTML syntax and return 'text/html' as the contentType for the tcod on a HTML host document.
Comment 3•6 years ago
|
||
Yeah, but I agree that maybe HTML should be changed to use "text/html" here for the HTML document case (you can detect it by seeing if element local names get lowercased when you create them).
Assignee | ||
Updated•6 years ago
|
Component: DOM → DOM: Core & HTML
Updated•2 years ago
|
Severity: normal → S3
You need to log in
before you can comment on or make changes to this bug.
Description
•