[whatwg] Should script run if it comes from a HTML fragment?

Ryosuke Niwa rniwa at webkit.org
Thu Nov 11 16:34:59 PST 2010

Greetings all,

I'm working on the WebKit bug 12234 - Using createContextualFragment to
insert a <script> does not cause the script to
 While investigating the issue, the following part of HTML5 spec came to my

* The "in head" insertion

   - *A start tag whose tag name is "script"*
   1. If the parser was originally created for the HTML fragment parsing
      algorithm, then mark the script element as "already started". (fragment

Since 10.4 Parsing HTML
not special case the script element, this seem to imply that we never
execute scripts inserted by the HTML fragment parsing algorithm.  Am I

To give you more concrete example, should the following markup show the
alert or not?

<!DOCTYPE html>

Best regards,
Ryosuke Niwa
Software Engineer
Google Inc.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.whatwg.org/pipermail/whatwg-whatwg.org/attachments/20101111/cb2d0867/attachment.htm>

More information about the whatwg mailing list