W3C home > Mailing lists > Public > public-appformats@w3.org > December 2006

[XBL] The script Element

From: Cameron McCormack <cam@mcc.id.au>
Date: Thu, 7 Dec 2006 20:39:33 +1000
To: public-appformats@w3.org
Message-ID: <20061207103933.GO4857@arc.mcc.id.au>

Hi.

This is a last call comment on the XBL 2 Editor’s Draft (dated 27
October 2006).

2.15 The script Element
=======================

  script blocks must be evaluated when their end-tag is parsed, or, for
  dynamically created elements, when they are first inserted into a
  document. This is the case whether or not the elements are in error.
  Once evaluated, a script block is dead and changes to its contents or
  attributes have no effect.

Does this mean an implementation must keep a track of whether a script
node has been inserted into a document before?  For example would this
cause only one alert to be shown:

  <svg xmlns="http://www.w3.org/2000/svg">
    <xbl id="x" xmlns="http://www.w3.org/ns/xbl"/>
    <script>
      var x = document.getElementById("x");
      var e = document.createElementNS("http://www.w3.org/ns/xbl",
                                       "script");
      e.textContent = "alert('hi')";
      x.appendChild(e);
      x.removeChild(e);
      x.appendChild(e);
    </script>
  </svg>

If so, what’s the reasoning behind this decision?  I think it would be
easier for implementations to just react to
DOMNode{InsertedInto,RemovedFrom}Document events.


Thanks,

Cameron

-- 
Cameron McCormack, http://mcc.id.au/
	xmpp:heycam@jabber.org  ▪  ICQ 26955922  ▪  MSN cam@mcc.id.au
Received on Thursday, 7 December 2006 10:31:46 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 8 January 2008 14:10:20 GMT