W3C home > Mailing lists > Public > www-dom@w3.org > October to December 2011

Re: [DOM4] atomicity of DocumentFragment insertion

From: Bjoern Hoehrmann <derhoermi@gmx.net>
Date: Fri, 28 Oct 2011 23:55:38 +0200
To: David Flanagan <dflanagan@mozilla.com>
Cc: www-dom@w3.org
Message-ID: <s29ma75hnk7eljhvtqssmimeqrn1eqgmfd@hive.bjoern.hoehrmann.de>
* 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); 
>     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

This archive was generated by hypermail 2.3.1 : Tuesday, 20 October 2015 10:46:18 UTC