[html5] r1606 - /

whatwg at whatwg.org whatwg at whatwg.org
Tue May 13 18:44:19 PDT 2008


Author: ianh
Date: 2008-05-13 18:44:18 -0700 (Tue, 13 May 2008)
New Revision: 1606

Modified:
   index
   source
Log:
[giow] (2) <script charset> support

Modified: index
===================================================================
--- index	2008-05-14 01:19:40 UTC (rev 1605)
+++ index	2008-05-14 01:44:18 UTC (rev 1606)
@@ -2391,7 +2391,7 @@
    href="#refsCSSOM">[CSSOM]</a>
 
   <p class=big-issue>See <a
-   href="http://dev.w3.org/cvsweb/~checkout~/csswg/cssom/Overview.html?rev=1.35&content-type=text/html;%20charset=utf-8">http://dev.w3.org/cvsweb/~checkout~/csswg/cssom/Overview.html?rev=1.35&content-type=text/html;%20charset=utf-8</a>
+   href="http://dev.w3.org/cvsweb/~checkout~/csswg/cssom/Overview.html?content-type=text/html;%20charset=utf-8">http://dev.w3.org/cvsweb/~checkout~/csswg/cssom/Overview.html?content-type=text/html;%20charset=utf-8</a>
 
   <p>Certain features are defined in terms of CSS <color> values. When
    the CSS value <code title="">currentColor</code> is specified in this
@@ -7823,24 +7823,7 @@
     default type is <code title="">text/css</code>, the style sheet
     <em>would</em> nonetheless be applied.</p>
   </div>
-  <!--(to be deleted) (charset dropped)
-  <p>The <dfn title="attr-link-charset"><code>charset</code></dfn>
-  attribute gives the character encoding of the linked resource. It is
-  purely advisory. The value must be a valid character encoding name.
-  <a href="#refsIANACHARSET">[IANACHARSET]</a></p>
 
-  <p>For <span title="external resource link">external resource
-  links</span>, user agents may use the character encoding given in
-  this attribute to decide whether or not to consider using the
-  resource at all. If the UA does not support the given encoding for
-  the given link relationship, then the UA may opt not to download and
-  apply the resource.</p>
-
-  <p>However, once the resource has been fetched, user agents must
-  follow the rules for that resource type when determining the actual
-  character encoding.</p>
--->
-
   <p>The <dfn id=title2 title=attr-link-title><code>title</code></dfn>
    attribute gives the title of the link. With one exception, it is purely
    advisory. The value is text. The exception is for style sheet links, where
@@ -22585,6 +22568,8 @@
 
    <dd><code title=attr-script-type><a href="#type11">type</a></code>
 
+   <dd><code title=attr-script-charset><a href="#charset2">charset</a></code>
+
    <dt>DOM interface:
 
    <dd>
@@ -22594,6 +22579,7 @@
            attribute boolean <code title=dom-script-async><a href="#async0">async</a></code>;
            attribute boolean <code title=dom-script-defer><a href="#defer0">defer</a></code>;
            attribute DOMString <code title=dom-script-type><a href="#type12">type</a></code>;
+           attribute DOMString <code title=dom-script-charset><a href="#charset3">charset</a></code>;
            attribute DOMString <code title=dom-script-text><a href="#text1">text</a></code>;
 };</pre>
   </dl>
@@ -22604,7 +22590,7 @@
   <p>When the <dfn id=src9 title=attr-script-src><code>src</code></dfn>
    attribute is set, the <code><a href="#script0">script</a></code> element
    refers to an external file. The value of the attribute must be a URI (or
-   IRI).
+   IRI). If the attribute is set, the element must be empty.
 
   <p>If the <code title=attr-script-src><a href="#src9">src</a></code>
    attribute is not set, then the script is given by the contents of the
@@ -22613,8 +22599,18 @@
   <p>The language of the script may be given by the <dfn id=type11
    title=attr-script-type><code>type</code></dfn> attribute. If the attribute
    is present, its value must be a valid MIME type, optionally with
-   parameters. <a href="#refsRFC2046">[RFC2046]</a>
+   parameters. The <code title="">charset</code> parameter must not be
+   specified. <a href="#refsRFC2046">[RFC2046]</a>
 
+  <p>The <dfn id=charset2
+   title=attr-script-charset><code>charset</code></dfn> attribute gives the
+   character encoding of the external file. The attribute must not be
+   specified if the <code title=attr-script-src><a
+   href="#src9">src</a></code> attribute is not present. If the attribute is
+   set, its value must be a valid character encoding name, and must be the
+   preferred name for that encoding. <a
+   href="#refsIANACHARSET">[IANACHARSET]</a>
+
   <p>The <dfn id=async title=attr-script-async><code>async</code></dfn> and
    <dfn id=defer title=attr-script-defer><code>defer</code></dfn> attributes
    are <a href="#boolean0" title="boolean attribute">boolean attributes</a>
@@ -22643,27 +22639,29 @@
 
   <p>Changing the <code title=attr-script-src><a href="#src9">src</a></code>,
    <code title=attr-script-type><a href="#type11">type</a></code>, <code
+   title=attr-script-charset><a href="#charset2">charset</a></code>, <code
    title=attr-script-async><a href="#async">async</a></code>, and <code
    title=attr-script-defer><a href="#defer">defer</a></code> attributes
    dynamically has no direct effect; these attribute are only used at
    specific times described below (namely, when the element is inserted into
    the document).
 
-  <p><code><a href="#script0">script</a></code> elements have three
-   associated pieces of metadata. The first is a flag indicating whether or
-   not the script block has been <dfn id=already>"already executed"</dfn>.
-   Initially, <code><a href="#script0">script</a></code> elements must have
-   this flag unset (script blocks, when created, are not "already executed").
-   When a <code><a href="#script0">script</a></code> element is cloned, the
-   "already executed" flag, if set, must be propagated to the clone when it
-   is created. The second is a flag indicating whether the element was <dfn
+  <p><code><a href="#script0">script</a></code> elements have four associated
+   pieces of metadata. The first is a flag indicating whether or not the
+   script block has been <dfn id=already>"already executed"</dfn>. Initially,
+   <code><a href="#script0">script</a></code> elements must have this flag
+   unset (script blocks, when created, are not "already executed"). When a
+   <code><a href="#script0">script</a></code> element is cloned, the "already
+   executed" flag, if set, must be propagated to the clone when it is
+   created. The second is a flag indicating whether the element was <dfn
    id=parser-inserted>"parser-inserted"</dfn>. This flag is set by the <a
    href="#html-0">HTML parser</a> and is used to handle <code
    title=dom-document-write-HTML><a
-   href="#document.write...">document.write()</a></code> calls. The third
-   piece of metadata is <dfn id=the-scripts><var>the script's
-   type</var></dfn>. It is determined when the script is run, based on the
-   attributes on the element at that time.
+   href="#document.write...">document.write()</a></code> calls. The third and
+   fourth pieces of metadata are <dfn id=the-scripts><var>the script's
+   type</var></dfn> and <dfn id=the-scripts0><var>the script's character
+   encoding</var></dfn>. They are determined when the script is run, based on
+   the attributes on the element at that time.
 
   <p><dfn id=running0 title="running a script">Running a script</dfn>: When a
    script block is <span>inserted into a document</span>, the user agent must
@@ -22696,6 +22694,19 @@
      title=attr-script-language>language</code> attribute.</p>
 
    <li>
+    <p>If the <code><a href="#script0">script</a></code> element has a <code
+     title=attr-script-charset><a href="#charset2">charset</a></code>
+     attribute, then let <var><a href="#the-scripts0">the script's character
+     encoding</a></var> for this <code><a href="#script0">script</a></code>
+     element be the encoding given by the <code title=attr-script-charset><a
+     href="#charset2">charset</a></code> attribute.</p>
+
+    <p>Otherwise, let <var><a href="#the-scripts0">the script's character
+     encoding</a></var> for this <code><a href="#script0">script</a></code>
+     element be the same as <a href="#character1" title="document's character
+     encoding">the encoding of the document itself</a>.</p>
+
+   <li>
     <p>If <a href="#scripting1">scripting is disabled</a>, or if the
      <code>Document</code> has <code title=dom-document-designMode><a
      href="#designMode">designMode</a></code> enabled, or if the <code><a
@@ -22914,6 +22925,17 @@
      <dd>
       <p>That file must be used as the file to execute.</p>
 
+      <p>The file must be interpreted using the character encoding given by
+       <var><a href="#the-scripts0">the script's character
+       encoding</a></var>, regardless of any metadata given by the file's <a
+       href="#content-type8" title=Content-Type>Content-Type metadata</a>.</p>
+
+      <p class=big-issue>This means that a UTF-16 document will always assume
+       external scripts are UTF-16...? This applies, e.g., to document's
+       created using createDocument()... It also means changing
+       document.charSet will affect the character encoding used to interpret
+       scripts, is that really what happens?</p>
+
      <dt>If the script is inline
 
      <dd>
@@ -22946,7 +22968,8 @@
 
   <p>The DOM attributes <dfn id=src10
    title=dom-script-src><code>src</code></dfn>, <dfn id=type12
-   title=dom-script-type><code>type</code></dfn>, <dfn id=async0
+   title=dom-script-type><code>type</code></dfn>, <dfn id=charset3
+   title=dom-script-charset><code>charset</code></dfn>, <dfn id=async0
    title=dom-script-async><code>async</code></dfn>, and <dfn id=defer0
    title=dom-script-defer><code>defer</code></dfn>, each must <a
    href="#reflect">reflect</a> the respective content attributes of the same

Modified: source
===================================================================
--- source	2008-05-14 01:19:40 UTC (rev 1605)
+++ source	2008-05-14 01:44:18 UTC (rev 1606)
@@ -664,7 +664,7 @@
   href="#refsCSSOM">[CSSOM]</a></p>
 
   <p class="big-issue">See <a
-  href="http://dev.w3.org/cvsweb/~checkout~/csswg/cssom/Overview.html?rev=1.35&content-type=text/html;%20charset=utf-8">http://dev.w3.org/cvsweb/~checkout~/csswg/cssom/Overview.html?rev=1.35&content-type=text/html;%20charset=utf-8</a></p>
+  href="http://dev.w3.org/cvsweb/~checkout~/csswg/cssom/Overview.html?content-type=text/html;%20charset=utf-8">http://dev.w3.org/cvsweb/~checkout~/csswg/cssom/Overview.html?content-type=text/html;%20charset=utf-8</a></p>
 
   <p>Certain features are defined in terms of CSS <color>
   values. When the CSS value <code title="">currentColor</code> is
@@ -6259,24 +6259,6 @@
 
   </div>
 
-<!--(to be deleted) (charset dropped)
-  <p>The <dfn title="attr-link-charset"><code>charset</code></dfn>
-  attribute gives the character encoding of the linked resource. It is
-  purely advisory. The value must be a valid character encoding name.
-  <a href="#refsIANACHARSET">[IANACHARSET]</a></p>
-
-  <p>For <span title="external resource link">external resource
-  links</span>, user agents may use the character encoding given in
-  this attribute to decide whether or not to consider using the
-  resource at all. If the UA does not support the given encoding for
-  the given link relationship, then the UA may opt not to download and
-  apply the resource.</p>
-
-  <p>However, once the resource has been fetched, user agents must
-  follow the rules for that resource type when determining the actual
-  character encoding.</p>
--->
-
   <p>The <dfn title="attr-link-title"><code>title</code></dfn>
   attribute gives the title of the link. With one exception, it is
   purely advisory. The value is text. The exception is for style sheet
@@ -20430,6 +20412,7 @@
    <dd><code title="attr-script-async">async</code></dd>
    <dd><code title="attr-script-defer">defer</code></dd>
    <dd><code title="attr-script-type">type</code></dd>
+   <dd><code title="attr-script-charset">charset</code></dd>
    <dt>DOM interface:</dt>
    <dd>
 <pre class="idl">interface <dfn>HTMLScriptElement</dfn> : <span>HTMLElement</span> {
@@ -20437,6 +20420,7 @@
            attribute boolean <code title="dom-script-async">async</code>;
            attribute boolean <code title="dom-script-defer">defer</code>;
            attribute DOMString <code title="dom-script-type">type</code>;
+           attribute DOMString <code title="dom-script-charset">charset</code>;
            attribute DOMString <code title="dom-script-text">text</code>;
 };</pre>
    </dd>
@@ -20448,7 +20432,7 @@
   <p>When the <dfn title="attr-script-src"><code>src</code></dfn>
   attribute is set, the <code>script</code> element refers to an
   external file. The value of the attribute must be a URI (or
-  IRI).</p>
+  IRI). If the attribute is set, the element must be empty.</p>
 
   <p>If the <code title="attr-script-src">src</code> attribute is not
   set, then the script is given by the contents of the element.</p>
@@ -20456,8 +20440,18 @@
   <p>The language of the script may be given by the <dfn
   title="attr-script-type"><code>type</code></dfn> attribute. If the
   attribute is present, its value must be a valid MIME type,
-  optionally with parameters. <a href="#refsRFC2046">[RFC2046]</a></p>
+  optionally with parameters. The <code title="">charset</code>
+  parameter must not be specified. <a
+  href="#refsRFC2046">[RFC2046]</a></p>
 
+  <p>The <dfn title="attr-script-charset"><code>charset</code></dfn>
+  attribute gives the character encoding of the external file. The
+  attribute must not be specified if the <code
+  title="attr-script-src">src</code> attribute is not present. If the
+  attribute is set, its value must be a valid character encoding name,
+  and must be the preferred name for that encoding.  <a
+  href="#refsIANACHARSET">[IANACHARSET]</a></p>
+
   <p>The <dfn title="attr-script-async"><code>async</code></dfn> and
   <dfn title="attr-script-defer"><code>defer</code></dfn> attributes
   are <span title="boolean attribute">boolean attributes</span> that
@@ -20485,13 +20479,14 @@
 
   <p>Changing the <code title="attr-script-src">src</code>, <code
   title="attr-script-type">type</code>, <code
+  title="attr-script-charset">charset</code>, <code
   title="attr-script-async">async</code>, and <code
   title="attr-script-defer">defer</code> attributes dynamically has no
   direct effect; these attribute are only used at specific times
   described below (namely, when the element is inserted into the
   document).</p>
 
-  <p><code>script</code> elements have three associated pieces of
+  <p><code>script</code> elements have four associated pieces of
   metadata. The first is a flag indicating whether or not the script
   block has been <dfn>"already executed"</dfn>. Initially,
   <code>script</code> elements must have this flag unset (script
@@ -20502,9 +20497,10 @@
   <dfn>"parser-inserted"</dfn>. This flag is set by the <span>HTML
   parser</span> and is used to handle <code
   title="dom-document-write-HTML">document.write()</code> calls. The
-  third piece of metadata is <dfn><var>the script's
-  type</var></dfn>. It is determined when the script is run, based on
-  the attributes on the element at that time.</p>
+  third and fourth pieces of metadata are <dfn><var>the script's
+  type</var></dfn> and <dfn><var>the script's character
+  encoding</var></dfn>. They are determined when the script is run,
+  based on the attributes on the element at that time.</p>
 
   <p><dfn title="running a script">Running a script</dfn>: When a
   script block is <span>inserted into a document</span>, the user
@@ -20539,6 +20535,21 @@
 
    <li>
 
+    <p>If the <code>script</code> element has a <code
+    title="attr-script-charset">charset</code> attribute, then let
+    <var>the script's character encoding</var> for this
+    <code>script</code> element be the encoding given by the <code
+    title="attr-script-charset">charset</code> attribute.</p>
+
+    <p>Otherwise, let <var>the script's character encoding</var> for
+    this <code>script</code> element be the same as <span
+    title="document's character encoding">the encoding of the document
+    itself</span>.</p>
+
+   </li>
+
+   <li>
+
     <p>If <span>scripting is disabled</span>, or if the
     <code>Document</code> has <code
     title="dom-document-designMode">designMode</code> enabled, or if
@@ -20835,6 +20846,18 @@
 
       <p>That file must be used as the file to execute.</p>
 
+      <p>The file must be interpreted using the character encoding
+      given by <var>the script's character encoding</var>, regardless
+      of any metadata given by the file's <span
+      title="Content-Type">Content-Type metadata</span>.</p>
+
+      <p class="big-issue">This means that a UTF-16 document will
+      always assume external scripts are UTF-16...? This applies,
+      e.g., to document's created using createDocument()... It also
+      means changing document.charSet will affect the character
+      encoding used to interpret scripts, is that really what
+      happens?</p>
+
      </dd>
 
      <dt>If the script is inline</dt>
@@ -20876,6 +20899,7 @@
   <p>The DOM attributes <dfn
   title="dom-script-src"><code>src</code></dfn>, <dfn
   title="dom-script-type"><code>type</code></dfn>, <dfn
+  title="dom-script-charset"><code>charset</code></dfn>, <dfn
   title="dom-script-async"><code>async</code></dfn>, and <dfn
   title="dom-script-defer"><code>defer</code></dfn>, each must
   <span>reflect</span> the respective content attributes of the same




More information about the Commit-Watchers mailing list