[Bug 20201] polyglot markup and extensions via <script> (and <style>)

https://www.w3.org/Bugs/Public/show_bug.cgi?id=20201

Leif Halvard Silli <xn--mlform-iua@xn--mlform-iua.no> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|WORKSFORME                  |FIXED

--- Comment #14 from Leif Halvard Silli <xn--mlform-iua@xn--mlform-iua.no> ---
EDITOR'S RESPONSE: This is an Editor's Response to your comment. If you are
satisfied with this response, please change the state of this bug to CLOSED. If
you have additional information and would like the Editor to reconsider, please
reopen this bug. If you would like to escalate the issue to the full HTML
Working Group, please add the TrackerRequest keyword to this bug, and suggest
title and text for the Tracker Issue; or you may create a Tracker Issue
yourself, if you are able to do so. For more details, see this document:

   http://dev.w3.org/html5/decision-policy/decision-policy.html

              Status: Partially Accepted
  Change Description: Simplify how to comment it out by removing enough
                      options and giving enough directions.
           Rationale: In comment #12, you emphasize that it is not the
                      "CDATA syntax itself" that is complex, but the
                      "ways how to comment it out inside HTML <script>"
                      Introducing usage rules that are strict enough,
                      should solve the described 'how to comment it
                      out' problem.
      Proposed rules: See below.

1. CDATA restrictions:
   * Only one CDATA section permitted per <script>/<style>
   * Before the CDATA section there can only be one node, which
     may consist of whitespaces, one XML comment and/or one
     scripting level comment.
   * After the CDATA section, there can only be whitespace.
   * The CDATA section is subject to HTML’s restrictions on
     <script>/<style> (in principle already in the spec)
   * Only single line comments are permitted. (This rules out
     CDATA for "text/css".)

2. The ]]> string
   * is always commented out if <![CDATA[ is commented out.
   * is never commented out if <![CDATA[ is not commented out.
   * Example:  //]]>  </script>

3. The <![CDATA[ string can be handled in 3 ways:

   A. <![CDATA[ - without commenting it out. 
      <script type="not-CSS-and-not-JS"> <![CDATA[foo]]> </script>.
    * Important: Unpermitted for 'text/css' and 'text/javascript'!
    * Advantage: Can be useful for type="text/html" and templating
      in general. Already supported in AmpleSDK, for instance.
      Svelte - saves bytes. Puristic.
    * Disadvantage: scripts might need to be tuned to support it.

   B. //<![CDATA[ - pure scripting language level commenting out.
      Comment starts in the node before the CDATA section:
    * Example: <script>//<[CDATA[
                       FOO; //]]></script>
    *  Advantage: Well known in JavaScript. Much used.
    * Disadvantage: Less safe for templating since the comment
                    could become treated as part of the template.

   C. <!--//--><![CDATA[ - Same as B, but the scripting comment
      is hidden inside an XML comment.
      * Example: <script><!--//--><[CDATA[
                          FOO; //]]></script>
      * Advantage: Versatile.
            - 'out of the box' compatible w/John Resig style templating
              (currently not compatible with AmpleSDK - probably bug)
            - compatible w/JavaScript
            - compatible w/CSS, however rule 2 above prevents validity
      * Disadvantage: The JavaScript linter might not like it.
                      The scripting language must accept <!--
                      as legal (which JavaScript does)

-- 
You are receiving this mail because:
You are the QA Contact for the bug.

Received on Saturday, 25 May 2013 03:13:37 UTC