W3C home > Mailing lists > Public > www-dom@w3.org > April to June 2012

[Bug 17529] New: Inserting multiple script elements using a document fragment isn't specified properly

From: <bugzilla@jessica.w3.org>
Date: Mon, 18 Jun 2012 07:13:10 +0000
To: www-dom@w3.org
Message-ID: <bug-17529-4009@http.www.w3.org/Bugs/Public/>
https://www.w3.org/Bugs/Public/show_bug.cgi?id=17529

           Summary: Inserting multiple script elements using a document
                    fragment isn't specified properly
           Product: WebAppsWG
           Version: unspecified
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DOM
        AssignedTo: annevk@annevk.nl
        ReportedBy: bugs@pettay.fi
         QAContact: public-webapps-bugzilla@w3.org
                CC: mike@w3.org, www-dom@w3.org


Per HTML spec inserting script element to DOM should execute it immediately
(I'm talking about var s = document.createElement("script"); s.textContent =
"alert('foo')"; document.body.appendChild(s); case)

Unfortunately it isn't clear what should happen when you have several
script elements in a document fragment and insert that document fragment to
DOM.

Gecko seems to execute scripts after all the nodes are in DOM.
This seems to be ok per spec, since nothing prevents to do 
"HTML: An element is said to have been inserted into a document when its root
element changes and is now the document's root element." atomically for several
elements and DOM4 just says
"Insert all nodes in nodes before child or at the end of parent if child is
null."
The behavior Gecko has doesn't cause problems to Mutation Record creation.

Presto and Webkit execute scripts one by one during the document fragment
insertion
but not in the same way. Webkit seems to remove nodes first from the document
fragment,
Presto removes them one by one. (Webkit's follow the spec here)
Anyhow, the tricky thing is that what if some script moves nodes during
insertion.
What kinds of Mutation Records should be created? What should actually happen
to the nodes
which are being inserted to DOM but which some script moves to elsewhere just
before insertion.

-- 
Configure bugmail: https://www.w3.org/Bugs/Public/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
Received on Monday, 18 June 2012 07:13:12 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Friday, 22 June 2012 06:14:09 GMT