Re: [DOM4] atomicity of DocumentFragment insertion

* David Flanagan wrote:
>This may be an issue for mutation events, and it also turns out to be an 
>issue for HTML script tags, which execute when children are inserted.  
>For example, what is the proper behavior of this code?:
>
>     // s and f are global variables
>     s = document.createElement("script");
>     document.head.appendChild(s);
>     f = document.createDocumentFragment();
>     f.appendChild(document.createTextNode("alert(s.text); 
>alert(f.childNodes.length);"));
>     f.appendChild(document.createTextNode("alert(2);"));
>     f.appendChild(document.createTextNode("alert(3);"));
>     s.appendChild(f);
>     alert(s.text);
>
>Firefox runs the code in all 3 text nodes and displays 5 alerts total. 
>The first and last alerts both contain the concatenated text of all 
>three text nodes. The second alert display 0 because there are no 
>children left in the document fragment.

Microsoft used to offer VM images you can use for browser testing, maybe
they still do. Anyway, IE9 in standards mode is the same.
-- 
Björn Höhrmann · mailto:bjoern@hoehrmann.de · http://bjoern.hoehrmann.de
Am Badedeich 7 · Telefon: +49(0)160/4415681 · http://www.bjoernsworld.de
25899 Dagebüll · PGP Pub. KeyID: 0xA4357E78 · http://www.websitedev.de/ 

Received on Friday, 28 October 2011 21:55:57 UTC