Closed Bug 40944 Opened 25 years ago Closed 25 years ago

doctype.systemId always empty in HTML

Categories

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

defect

Tracking

()

VERIFIED FIXED

People

(Reporter: hjtoi-bugzilla, Assigned: jst)

References

()

Details

(Whiteboard: nsbeta2+ [jst])

This is not implemented. Even HTML documents can have system id, see for example the W3C doc in the URL. (I am working on the implementation of doctype for XML.)
This is needed for the editor people to be able to output the doctype when a document is saved. This should be really easy to fix and the fix should be very low risk, nominating for beta2.
Status: NEW → ASSIGNED
Keywords: nsbeta2
David, we decided to expose the doctype even for HTML document since the editor needs to access the doctype info, and since the DOM defines the doctype property we decided to use that existing interface, even if the DOM spec says it's always null for HTML documents (which doesn't make sense to me anyway, it made more sense in DOM1 since the only thing you could access was the doctype name which is always "HTML", and entities and notations which are not supported in HTML).
David: What would we break if we implemented this? I can't think of any code that would _rely_ on expecting NULL... You can't even use a NULL check to make sure that it's an HTML document, since some XML documents also return NULL. (This should not be taken to mean that I'm in favour of us breaking the spec here, it's just that I'm wondering if it would break anything.)
I don't understand either why DOM 2 wants HTML always return NULL for doctype. doctype is a DOM core property, why would we want to return NULL when we can use it for something meaningful? The public id is the only "reliable" method of detecting the HTML version in the document, right? In Mozilla's case, it can also be checked by scripts to guess if Mozilla is using strict or quirks mode.
The DOM spec doesn't say the doctype is *always* null, it says it will report NULL if the doctype was absent in the source document. Mozilla will *always* insert a doctype to support the editor (and script writers) who care to know how we behave by default. approved for nsbeta2.
Whiteboard: nsbeta2+
I have a fix for this sitting in my tree, I'll need to do some more testing before checking in.
Whiteboard: nsbeta2+ → nsbeta2+ [jst]
The fix for this is now checked in, marking FIXED.
Status: ASSIGNED → RESOLVED
Closed: 25 years ago
Resolution: --- → FIXED
Adding verifyme keyword.
Keywords: verifyme
Marking verified.
Status: RESOLVED → VERIFIED
Component: DOM Level 2 → DOM HTML
Component: DOM: HTML → DOM: Core & HTML
QA Contact: vidur → general
Keywords: verifyme
You need to log in before you can comment on or make changes to this bug.