- From: Elliott Sprehn <esprehn@gmail.com>
- Date: Tue, 12 Jun 2012 10:48:45 -0700
- To: Boris Zbarsky <bzbarsky@mit.edu>
- Cc: public-webapps@w3.org, www-dom <www-dom@w3.org>
- Message-ID: <CAPJYB1gOmOvDfYSVuDLjoCnk=2E5njrSbXh=znjLFF1Su_dcHw@mail.gmail.com>
On Mon, Jun 11, 2012 at 9:17 PM, Boris Zbarsky <bzbarsky@mit.edu> wrote:
> On 6/11/12 7:39 PM, Elliott Sprehn wrote:
>
>> After discussing this with some other contributors there were questions
>> on why we're enforcing the order of the document child nodes.
>>
>
> Because otherwise serialization of the result would be ... very broken?
Inserting doctype nodes has no effect on the mode of the document though,
so it's already possible to produce a broken serialization (one in the
wrong mode). For instance you can remove the doctype node and then
serialize or swap the doctype node and then serialize.
>
> Can we leave the behavior when your document is out of order unspecified?
>>
>
> You mean allow UAs to throw or not as they wish? That seems like a pretty
> bad idea, honestly. We should require that the insertion be allowed (and
> then specify what DOM it produces) or require that it throw.
In practice I don't think anyone inserts these in the wrong order (or
insert doctypes at all since they have no effect). If you wanted to
dynamically create a document you'd do it with document.write('<!DOCTYPE
html>') and then replaceChild the root element which was created for you.
Implementing this ordering restriction requires changing the append and
replace methods substantially in Webkit for a case I'm not sure developers
realize exists.
- Elliott
Received on Tuesday, 12 June 2012 17:49:35 UTC