W3C home > Mailing lists > Public > public-svg-wg@w3.org > July to September 2008

<script> element processing proposed text

From: Cameron McCormack <cam@mcc.id.au>
Date: Thu, 4 Sep 2008 15:57:38 +1000
To: public-svg-wg@w3.org
Message-ID: <20080904055738.GF3118@arc.mcc.id.au>

Hello WG.

For ACTION-2063, I’m to fix the spec to make <script> processing more
consistent with HTML.  Here is my proposed rewording of the first part
of section 15.2.1 “Script processing”:

  Execution of a given 'script' element occurs at most once.  There is a
  conceptual flag associated with each 'script' element (referred to
  here as the "already processed" flag) that enforces this behavior.
  When 'script' elements are executed depends on how they came to be in
  the document.

  One way for a 'script' element to be in the document is if it
  was inserted while parsing the document.  As mentioned in 5.9.2
  Progressive rendering, as the document is parsed if a 'script' element
  is encountered then it will be processed just after the element is
  inserted into the document, but before any more of the document is
  parsed and further nodes inserted into the document.  (See below for a
  description of what it means for a 'script' element to be processed.)
  Once processed, parsing of the document resumes.

  The other way a 'script' element to be in the document is if it was
  inserted into the document by something other than the parser (such
  as by other script executing).  In this case, as soon as one or more
  'script' elements are inserted into the document, they must be
  processed one by one in document order.

  A 'script' element is processed as follows:

    1. If the 'script' element’s "already processed" flag is true or if
       the element is not in the document tree, then no action is
       performed and these steps are ended.
    2. If the 'script' element references external script content (that
       is, it has an 'xlink:href' attribute specified), then processing
       blocks until that external script content referenced by the
       current value of 'xlink:href' has been fetched or is determined
       to be an _invalid IRI reference_.
    3. The 'script' element’s "already processed" flag 
    4. If the script content is inline, or if is external and was
       fetched succesfully, then the script is executed.  Note that at
       this point, these steps may be re-entrant if the execution of the
       script results in further 'script' elements being inserted into
       the document.

  Note that, as described in 5.9.2 Progressive rendering, a _load_ event
  is dispatched on a 'script' element once it has been processed, unless
  it referenced external script content with an _invalid IRI reference_
  and 'externalResourceRequired' was set to "true".

  Modifying a 'script' element’s 'xlink:href' attribute after its
  "already processed" flag is set to true will not cause any new script
  content to be fetched or executed.

I will also have to make concomitant changes to the progressive
rendering section to ensure that nodes are inserted in the right place
when parsing, and stating that if the node just inserted was a 'script',
that it executes before the load event is dispatched and parsing
continues.  (That would be for ACTION-2107.)

Comments please.

Thanks,

Cameron

-- 
Cameron McCormack ≝ http://mcc.id.au/
Received on Thursday, 4 September 2008 05:58:17 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 21:20:09 UTC