Re: [DOM4] Mutation algorithm imposed order on document children

I assume because they serialize document.doctype and then append (in
essence) document.documentElement.outerHTML.

I'd much rather the spec require serialization to respect the document mode
and output the doctype required to ensure that reading in the serialized
document produces the same document state.

That is we should require Unserialize(Serialize(document)) == document

Requiring that document.childNodes be in a specific order doesn't meet this
requirement since you can still do
document.removeChild(document.firstChild); Serialize(document) and get
something that doesn't represent the real document state.

On Tue, Jun 12, 2012 at 1:40 PM, Ryosuke Niwa <rniwa@webkit.org> wrote:

> I see. And IE9 uses the doctype that has been inserted into an incorrect
> place? If so, I would be interested in hearing why Microsoft decided to do
> this.
>
> - Ryosuke
> On Jun 12, 2012 1:35 PM, "Elliott Sprehn" <esprehn@gmail.com> wrote:
>
>> IE9 _does_ expose the doctype node. It's IE8 that doesn't but I've
>> ignored that case.
>>
>> On Tue, Jun 12, 2012 at 1:14 PM, Ryosuke Niwa <rniwa@webkit.org> wrote:
>>
>>> On Tue, Jun 12, 2012 at 1:09 PM, Elliott Sprehn <esprehn@gmail.com>wrote:
>>>
>>>> Good question, I assume you mean new
>>>> XMLSerializer().serializeToString(document)?
>>>>
>>>> FF: Correct order because it forces it on you.
>>>> Webkit: Doctype printed out of order.
>>>> IE9: Doctype always printed in order.
>>>> Opera: Doesn't ever print the doctype. But is the only one to print the
>>>> XML prolog.
>>>>
>>>> IE9's behavior seems the most sane here since it makes sure the
>>>> serialization is valid in the face of developer error similar to
>>>> serializing the parsed result of <b><a></b></a>.
>>>>
>>>
>>> However, it'll be odd if the order in which nodes appear in DOM and the
>>> order in which they appear in the markup differ. From what you've described
>>> so far, it's okay for IE9 to do this because it doesn't expose DocType
>>> node. I'm not certain it makes sense for us to do the same in the world
>>> where we expose DocType nodes.
>>>
>>> - Ryosuke
>>>
>>>
>>

Received on Tuesday, 12 June 2012 20:55:58 UTC