Closed
Bug 450160
Opened 16 years ago
Closed 16 years ago
DOMImplementation createDocument does not create an HTML document
Categories
(Core :: DOM: Core & HTML, defect)
Core
DOM: Core & HTML
Tracking
()
RESOLVED
FIXED
People
(Reporter: roc, Assigned: smaug)
References
()
Details
(Keywords: fixed1.9.1, Whiteboard: [verified1.9.1b4: Bv1])
Attachments
(2 files)
12.68 KB,
patch
|
bzbarsky
:
review+
bzbarsky
:
superreview+
|
Details | Diff | Splinter Review |
4.56 KB,
patch
|
smaug
:
review+
|
Details | Diff | Splinter Review |
The Acid3 test does something like this: var doctype = document.implementation.createDocumentType("html", "-//W3C//DTD XHTML 1.0 Strict//EN", "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"); var doc = document.implementation.createDocument("http://www.w3.org/1999/xhtml", "html", doctype); doc.documentElement.appendChild(doc.createElementNS("http://www.w3.org/1999/xhtml", "head")); doc.documentElement.appendChild(doc.createElementNS("http://www.w3.org/1999/xhtml", "body")); doc.body.appendChild(doc.createElementNS("http://www.w3.org/1999/xhtml", "form")); but doc.body is not defined because we create an nsXMLDocument. I guess all that's needed is to change the createDocument logic to behave more like the XML sink?
Reporter | ||
Comment 1•16 years ago
|
||
Setting up an nsHTMLDocument actually looks pretty hard :-(. Someone with more mojo than me should look at it. The other option is to just move functionality up to nsDocument. HTML5 says that every document object should implement all document interfaces so this is really what we should be doing anyway. A lot of it would move up relatively easily but of course the stuff that's complicated to set up in nsHTMLDocument would be hard to move.
I'm haven't yet looked into the feasibility of what HTML5 says. That said, it shouldn't be *that* hard to create a HTML document. XSLT does a decently good job, look at http://mxr.mozilla.org/mozilla-central/source/content/xslt/src/xslt/txMozillaXMLOutput.cpp#844 http://mxr.mozilla.org/mozilla-central/source/content/xml/document/src/nsXMLContentSink.cpp#387
Assignee | ||
Updated•16 years ago
|
Assignee: nobody → Olli.Pettay
Assignee | ||
Updated•16 years ago
|
Assignee | ||
Comment 3•16 years ago
|
||
This is my interpretation of the DOM 3 Core; create document based on doc type's publicId. The systemId may in principle point to any place, it doesn't even have to be an absolute URI. WebKit does something wrong here, it creates the document based on the namespaceURI parameter of .createDocument(). That is not what the spec says: 'Note that based on the DocumentType given to create the document, the implementation may instantiate specialized Document objects that support additional features than the "Core"' A fun part is also that ACID3 relies on an "implementation _may_" feature :/ Anyway, the patch fixes ACID3 test 98. Jonas, Boris, anyone, comments?
Attachment #339252 -
Flags: superreview?(jonas)
Attachment #339252 -
Flags: review?(bzbarsky)
Comment 4•16 years ago
|
||
> A fun part is also that ACID3 relies on an "implementation _may_" feature :/
That would make it a bug in the test. Have you reported it to Ian?
Patch looks OK on quick skim; I'll try to do a detailed review on Monday, probably. One question: do we currently create docshell-less HTML documents anywhere? If not, what sort of auditing have you done to make sure that we don't have code that assumes an HTML document is always in a docshell, has a window, etc?
Assignee | ||
Comment 5•16 years ago
|
||
(In reply to comment #4) > One question: do we currently create docshell-less HTML documents > anywhere? If not, what sort of auditing have you done to make sure that we > don't have code that assumes an HTML document is always in a docshell, has a > window, etc? We do support .cloneNode nowadays. And I re-checked some code and as far as I see having docshell-less htmldocument means that contentEditable/midas isn't available and document.open/write/close don't work (like they don't work with xhtml anyway).
Comment 6•16 years ago
|
||
> We do support .cloneNode nowadays.
You mean on documents?
Basically, did you look at the various window, script global object, container, scope object, etc users in nsHTMLDocument and in places that explicitly work on HTML documents?
Assignee | ||
Comment 7•16 years ago
|
||
I searched HTMLDocument in the tree and so far nothing bad found. .open/.write/.close and different editing things just won't work - could file a followups to fix those if really needed.
Comment 8•16 years ago
|
||
Having those not work on in-memory HTML seems just fine to me.
Updated•16 years ago
|
Attachment #339252 -
Flags: superreview?(jonas)
Attachment #339252 -
Flags: superreview+
Attachment #339252 -
Flags: review?(bzbarsky)
Attachment #339252 -
Flags: review+
Assignee | ||
Updated•16 years ago
|
Status: NEW → RESOLVED
Closed: 16 years ago
Resolution: --- → FIXED
XSLT has also created out-of-docshell HTML documents for a long time (through xsltprocessor.transformToDocument). Not sure that we auditid very many things though. There is also the question of what .cookies should do when gotten/set.
Assignee | ||
Updated•15 years ago
|
Attachment #371074 -
Flags: review?(bzbarsky) → review+
Comment 11•15 years ago
|
||
Comment on attachment 371074 [details] [diff] [review] (Bv1) Remove blank lines in log [Checkin: Comment 11 & 12] http://hg.mozilla.org/mozilla-central/rev/ef8da5d2aeb7
Attachment #371074 -
Attachment description: (Bv1) Remove blank lines in log → (Bv1) Remove blank lines in log
[Checkin: Comment 11]
Updated•15 years ago
|
Flags: in-testsuite+
Comment 12•15 years ago
|
||
Comment on attachment 371074 [details] [diff] [review] (Bv1) Remove blank lines in log [Checkin: Comment 11 & 12] http://hg.mozilla.org/releases/mozilla-1.9.1/rev/c8b3efbf0f48
Attachment #371074 -
Attachment description: (Bv1) Remove blank lines in log
[Checkin: Comment 11] → (Bv1) Remove blank lines in log
[Checkin: Comment 11 & 12]
Updated•15 years ago
|
Keywords: fixed1.9.1
Whiteboard: [fixed1.9.1b4: Bv1]
Comment 13•15 years ago
|
||
(In reply to comment #12) > http://hg.mozilla.org/releases/mozilla-1.9.1/rev/c8b3efbf0f48 This part is verified1.9.1, per { http://tinderbox.mozilla.org/showlog.cgi?log=SeaMonkey/1238938947.1238945640.4337.gz&fulltext=1 Linux comm-central unit test on 2009/04/05 06:42:27 }
Whiteboard: [fixed1.9.1b4: Bv1] → [verified1.9.1b4: Bv1]
Updated•5 years ago
|
Component: DOM → DOM: Core & HTML
You need to log in
before you can comment on or make changes to this bug.
Description
•