- From: Ian Hickson <ian@hixie.ch>
- Date: Tue, 4 Oct 2011 00:31:05 +0000 (UTC)
- To: David Flanagan <dflanagan@mozilla.com>
- cc: www-dom@w3.org
On Mon, 3 Oct 2011, David Flanagan wrote: > > The HTML parsing algorithm has steps that require one to "set the > Document to quirks-mode" or "set the Document to limited quirks-mode". > The DOM doesn't define any API for doing that, but does define the > Document.compatMode attribute which depends on those settings having > been made. As far as I can tell, this means that it is not possible to > implement a conforming HTML parser unless you're also implementing the > DOM itself. You don't need a DOM necessarily, but if you are implementing a parser that does expose a DOM, then yes, you need a conforming DOM. > I can't, for example, write an HTML parser in JavaScript that builds a > tree using the native DOM provided by a browser, since I can't get the > correct behavior for compatMode. Correct. You also can't build an HTTP library based on the HTTP library provided by the browser. :-) > I propose, therefore, that DOM4 add a 4th argument to createDocumentType(). > If true, then the document associated with that document type would be in > quirks mode. What's the use case? "Implementing an HTML parser in JavaScript in a browser" isn't a valid use case since browsers already expose HTML parsers, just like they expose DOMs. If you want to reimplement one of these, you need to reimplement the other, because it's all part of implementing a browser. -- Ian Hickson U+1047E )\._.,--....,'``. fL http://ln.hixie.ch/ U+263A /, _.. \ _\ ;`._ ,. Things that are impossible just take longer. `._.-(,_..'--(,_..'`-.;.'
Received on Tuesday, 4 October 2011 00:34:24 UTC