[html5] r7785 - [e] (0) Option constructor: clean up to use more WebIDL features, behave more li [...]

whatwg at whatwg.org whatwg at whatwg.org
Mon Apr 1 10:57:45 PDT 2013


Author: ianh
Date: 2013-04-01 10:57:43 -0700 (Mon, 01 Apr 2013)
New Revision: 7785

Modified:
   complete.html
   index
   source
Log:
[e] (0) Option constructor: clean up to use more WebIDL features, behave more like IE for the first argument. Add some rationale for Web Storage disk quota suggestions.
Affected topics: DOM APIs, HTML

Modified: complete.html
===================================================================
--- complete.html	2013-04-01 17:03:57 UTC (rev 7784)
+++ complete.html	2013-04-01 17:57:43 UTC (rev 7785)
@@ -50858,11 +50858,7 @@
    <dd><code title=attr-option-value><a href=#attr-option-value>value</a></code> — Value to be used for <a href=#form-submission>form submission</a></dd>
    <dt><a href=#element-dfn-dom title=element-dfn-dom>DOM interface</a>:</dt><!--TOPIC:DOM APIs-->
    <dd>
-<pre class=idl>[NamedConstructor=<a href=#dom-option title=dom-option>Option</a>(),
- NamedConstructor=<a href=#dom-option-t title=dom-option-t>Option</a>(DOMString text),
- NamedConstructor=<a href=#dom-option-tv title=dom-option-tv>Option</a>(DOMString text, DOMString value),
- NamedConstructor=<a href=#dom-option-tvd title=dom-option-tvd>Option</a>(DOMString text, DOMString value, boolean defaultSelected),
- NamedConstructor=<a href=#dom-option-tvds title=dom-option-tvds>Option</a>(DOMString text, DOMString value, boolean defaultSelected, boolean selected)]
+<pre class=idl>[NamedConstructor=<a href=#dom-option title=dom-option>Option</a>(optional DOMString text, optional DOMString value, optional boolean defaultSelected, optional boolean selected)]
 interface <dfn id=htmloptionelement>HTMLOptionElement</dfn> : <a href=#htmlelement>HTMLElement</a> {
            attribute boolean <a href=#dom-option-disabled title=dom-option-disabled>disabled</a>;
   readonly attribute <a href=#htmlformelement>HTMLFormElement</a>? <a href=#dom-option-form title=dom-option-form>form</a>;
@@ -50875,7 +50871,7 @@
   readonly attribute long <a href=#dom-option-index title=dom-option-index>index</a>;
 };</pre>
    </dd>
-  </dl><!--TOPIC:HTML--><p>The <code><a href=#the-option-element>option</a></code> element <a href=#represents>represents</a> an option
+  </dl><!--TOPIC:HTML--><!--CLEANUP--><p>The <code><a href=#the-option-element>option</a></code> element <a href=#represents>represents</a> an option
   in a <code><a href=#the-select-element>select</a></code> element or as part of a list of suggestions
   in a <code><a href=#the-datalist-element>datalist</a></code> element.</p>
 
@@ -50929,8 +50925,8 @@
   <a href=#concept-option-selectedness title=concept-option-selectedness>selectedness</a> must
   be set to true.</p>
 
-  <p class=note>The <code title=dom-option-tvd><a href=#dom-option-tvd>Option()</a></code>
-  constructor with three or fewer arguments overrides the initial
+  <p class=note>The <code title=dom-option><a href=#dom-option>Option()</a></code>
+  constructor, when called with three or fewer arguments, overrides the initial
   state of the <a href=#concept-option-selectedness title=concept-option-selectedness>selectedness</a> state to
   always be false even if the third argument is true (implying that a
   <code title=attr-option-selected><a href=#attr-option-selected>selected</a></code> attribute is to
@@ -51048,14 +51044,17 @@
   attribute must return the same value as the <code title=dom-fae-form><a href=#dom-fae-form>form</a></code> IDL attribute
   on that <code><a href=#the-select-element>select</a></code> element. Otherwise, it must return null.</p>
 
-  <p>Several constructors are provided for creating <code><a href=#htmloptionelement>HTMLOptionElement</a></code> objects (in
-  addition to the factory methods from DOM such as <code title="">createElement()</code>): <dfn id=dom-option title=dom-option><code>Option()</code></dfn>, <dfn id=dom-option-t title=dom-option-t><code>Option(<var title="">text</var>)</code></dfn>, <dfn id=dom-option-tv title=dom-option-tv><code>Option(<var title="">text</var>, <var title="">value</var>)</code></dfn>, <dfn id=dom-option-tvd title=dom-option-tvd><code>Option(<var title="">text</var>, <var title="">value</var>, <var title="">defaultSelected</var>)</code></dfn>, and <dfn id=dom-option-tvds title=dom-option-tvds><code>Option(<var title="">text</var>, <var title="">value</var>, <var title="">defaultSelected</var>, <var title="">selected</var>)</code></dfn>. When invoked as constructors, these must return a new
-  <code><a href=#htmloptionelement>HTMLOptionElement</a></code> object (a new <code><a href=#the-option-element>option</a></code> element). If the <var title="">text</var> argument is present, the new object must have as its only child a
-  <code><a href=#text>Text</a></code> node whose data is the value of that argument. If the <var title="">value</var>
+<!--CLEANUP-->
+  <p>A constructor is provided for creating <code><a href=#htmloptionelement>HTMLOptionElement</a></code> objects (in
+  addition to the factory methods from DOM such as <code title="">createElement()</code>):
+  <dfn id=dom-option title=dom-option><code>Option(<var title="">text</var>, <var title="">value</var>, <var title="">defaultSelected</var>, <var title="">selected</var>)</code></dfn>. When invoked as a constructor, it must return a new
+  <code><a href=#htmloptionelement>HTMLOptionElement</a></code> object (a new <code><a href=#the-option-element>option</a></code> element).
+  If the first argument is not the empty string, the new object must have as its only child a
+  <code><a href=#text>Text</a></code> node whose data is the value of that argument. Otherwise, it must have no children. If the <var title="">value</var>
   argument is present, the new object must have a <code title=attr-option-value><a href=#attr-option-value>value</a></code>
-  attribute set with the value of the argument as its value. If the <var title="">defaultSelected</var> argument is present and true, the new object must have a <code title=attr-option-selected><a href=#attr-option-selected>selected</a></code> attribute set with no value. If the <var title="">selected</var> argument is present and true, the new object must have its <a href=#concept-option-selectedness title=concept-option-selectedness>selectedness</a> set to true; otherwise the fourth argument
-  is absent or false, and the <a href=#concept-option-selectedness title=concept-option-selectedness>selectedness</a> must be
-  set to false, even if the <var title="">defaultSelected</var> argument is present and true. The
+  attribute set with the value of the argument as its value. If the <var title="">defaultSelected</var> argument is true, the new object must have a <code title=attr-option-selected><a href=#attr-option-selected>selected</a></code> attribute set with no value. If the <var title="">selected</var> argument is true, the new object must have its <a href=#concept-option-selectedness title=concept-option-selectedness>selectedness</a> set to true; otherwise
+  the <a href=#concept-option-selectedness title=concept-option-selectedness>selectedness</a> must be
+  set to false, even if the <var title="">defaultSelected</var> argument is true. The
   element's document must be the <a href=#active-document>active document</a> of the <a href=#browsing-context>browsing context</a>
   of the <code><a href=#window>Window</a></code> object on which the interface object of the invoked constructor is
   found.</p>
@@ -83169,9 +83168,10 @@
 
 
   <h3 id=disk-space-0><span class=secno>11.3 </span>Disk space</h3>
+<!--CLEANUP-->
 
   <p>User agents should limit the total amount of space allowed for
-  storage areas.</p>
+  storage areas, because hostile authors could otherwise use this feature to exhaust the user's available disk space.</p>
 
   <p>User agents should guard against sites storing data under their
   origin's other affiliated sites, e.g. storing up to the limit in

Modified: index
===================================================================
--- index	2013-04-01 17:03:57 UTC (rev 7784)
+++ index	2013-04-01 17:57:43 UTC (rev 7785)
@@ -50858,11 +50858,7 @@
    <dd><code title=attr-option-value><a href=#attr-option-value>value</a></code> — Value to be used for <a href=#form-submission>form submission</a></dd>
    <dt><a href=#element-dfn-dom title=element-dfn-dom>DOM interface</a>:</dt><!--TOPIC:DOM APIs-->
    <dd>
-<pre class=idl>[NamedConstructor=<a href=#dom-option title=dom-option>Option</a>(),
- NamedConstructor=<a href=#dom-option-t title=dom-option-t>Option</a>(DOMString text),
- NamedConstructor=<a href=#dom-option-tv title=dom-option-tv>Option</a>(DOMString text, DOMString value),
- NamedConstructor=<a href=#dom-option-tvd title=dom-option-tvd>Option</a>(DOMString text, DOMString value, boolean defaultSelected),
- NamedConstructor=<a href=#dom-option-tvds title=dom-option-tvds>Option</a>(DOMString text, DOMString value, boolean defaultSelected, boolean selected)]
+<pre class=idl>[NamedConstructor=<a href=#dom-option title=dom-option>Option</a>(optional DOMString text, optional DOMString value, optional boolean defaultSelected, optional boolean selected)]
 interface <dfn id=htmloptionelement>HTMLOptionElement</dfn> : <a href=#htmlelement>HTMLElement</a> {
            attribute boolean <a href=#dom-option-disabled title=dom-option-disabled>disabled</a>;
   readonly attribute <a href=#htmlformelement>HTMLFormElement</a>? <a href=#dom-option-form title=dom-option-form>form</a>;
@@ -50875,7 +50871,7 @@
   readonly attribute long <a href=#dom-option-index title=dom-option-index>index</a>;
 };</pre>
    </dd>
-  </dl><!--TOPIC:HTML--><p>The <code><a href=#the-option-element>option</a></code> element <a href=#represents>represents</a> an option
+  </dl><!--TOPIC:HTML--><!--CLEANUP--><p>The <code><a href=#the-option-element>option</a></code> element <a href=#represents>represents</a> an option
   in a <code><a href=#the-select-element>select</a></code> element or as part of a list of suggestions
   in a <code><a href=#the-datalist-element>datalist</a></code> element.</p>
 
@@ -50929,8 +50925,8 @@
   <a href=#concept-option-selectedness title=concept-option-selectedness>selectedness</a> must
   be set to true.</p>
 
-  <p class=note>The <code title=dom-option-tvd><a href=#dom-option-tvd>Option()</a></code>
-  constructor with three or fewer arguments overrides the initial
+  <p class=note>The <code title=dom-option><a href=#dom-option>Option()</a></code>
+  constructor, when called with three or fewer arguments, overrides the initial
   state of the <a href=#concept-option-selectedness title=concept-option-selectedness>selectedness</a> state to
   always be false even if the third argument is true (implying that a
   <code title=attr-option-selected><a href=#attr-option-selected>selected</a></code> attribute is to
@@ -51048,14 +51044,17 @@
   attribute must return the same value as the <code title=dom-fae-form><a href=#dom-fae-form>form</a></code> IDL attribute
   on that <code><a href=#the-select-element>select</a></code> element. Otherwise, it must return null.</p>
 
-  <p>Several constructors are provided for creating <code><a href=#htmloptionelement>HTMLOptionElement</a></code> objects (in
-  addition to the factory methods from DOM such as <code title="">createElement()</code>): <dfn id=dom-option title=dom-option><code>Option()</code></dfn>, <dfn id=dom-option-t title=dom-option-t><code>Option(<var title="">text</var>)</code></dfn>, <dfn id=dom-option-tv title=dom-option-tv><code>Option(<var title="">text</var>, <var title="">value</var>)</code></dfn>, <dfn id=dom-option-tvd title=dom-option-tvd><code>Option(<var title="">text</var>, <var title="">value</var>, <var title="">defaultSelected</var>)</code></dfn>, and <dfn id=dom-option-tvds title=dom-option-tvds><code>Option(<var title="">text</var>, <var title="">value</var>, <var title="">defaultSelected</var>, <var title="">selected</var>)</code></dfn>. When invoked as constructors, these must return a new
-  <code><a href=#htmloptionelement>HTMLOptionElement</a></code> object (a new <code><a href=#the-option-element>option</a></code> element). If the <var title="">text</var> argument is present, the new object must have as its only child a
-  <code><a href=#text>Text</a></code> node whose data is the value of that argument. If the <var title="">value</var>
+<!--CLEANUP-->
+  <p>A constructor is provided for creating <code><a href=#htmloptionelement>HTMLOptionElement</a></code> objects (in
+  addition to the factory methods from DOM such as <code title="">createElement()</code>):
+  <dfn id=dom-option title=dom-option><code>Option(<var title="">text</var>, <var title="">value</var>, <var title="">defaultSelected</var>, <var title="">selected</var>)</code></dfn>. When invoked as a constructor, it must return a new
+  <code><a href=#htmloptionelement>HTMLOptionElement</a></code> object (a new <code><a href=#the-option-element>option</a></code> element).
+  If the first argument is not the empty string, the new object must have as its only child a
+  <code><a href=#text>Text</a></code> node whose data is the value of that argument. Otherwise, it must have no children. If the <var title="">value</var>
   argument is present, the new object must have a <code title=attr-option-value><a href=#attr-option-value>value</a></code>
-  attribute set with the value of the argument as its value. If the <var title="">defaultSelected</var> argument is present and true, the new object must have a <code title=attr-option-selected><a href=#attr-option-selected>selected</a></code> attribute set with no value. If the <var title="">selected</var> argument is present and true, the new object must have its <a href=#concept-option-selectedness title=concept-option-selectedness>selectedness</a> set to true; otherwise the fourth argument
-  is absent or false, and the <a href=#concept-option-selectedness title=concept-option-selectedness>selectedness</a> must be
-  set to false, even if the <var title="">defaultSelected</var> argument is present and true. The
+  attribute set with the value of the argument as its value. If the <var title="">defaultSelected</var> argument is true, the new object must have a <code title=attr-option-selected><a href=#attr-option-selected>selected</a></code> attribute set with no value. If the <var title="">selected</var> argument is true, the new object must have its <a href=#concept-option-selectedness title=concept-option-selectedness>selectedness</a> set to true; otherwise
+  the <a href=#concept-option-selectedness title=concept-option-selectedness>selectedness</a> must be
+  set to false, even if the <var title="">defaultSelected</var> argument is true. The
   element's document must be the <a href=#active-document>active document</a> of the <a href=#browsing-context>browsing context</a>
   of the <code><a href=#window>Window</a></code> object on which the interface object of the invoked constructor is
   found.</p>
@@ -83169,9 +83168,10 @@
 
 
   <h3 id=disk-space-0><span class=secno>11.3 </span>Disk space</h3>
+<!--CLEANUP-->
 
   <p>User agents should limit the total amount of space allowed for
-  storage areas.</p>
+  storage areas, because hostile authors could otherwise use this feature to exhaust the user's available disk space.</p>
 
   <p>User agents should guard against sites storing data under their
   origin's other affiliated sites, e.g. storing up to the limit in

Modified: source
===================================================================
--- source	2013-04-01 17:03:57 UTC (rev 7784)
+++ source	2013-04-01 17:57:43 UTC (rev 7785)
@@ -60335,11 +60335,7 @@
    <dd><code title="attr-option-value">value</code></dd>
    <dt><span title="element-dfn-dom">DOM interface</span>:</dt><!--TOPIC:DOM APIs-->
    <dd>
-<pre class="idl">[NamedConstructor=<span title="dom-option">Option</span>(),
- NamedConstructor=<span title="dom-option-t">Option</span>(DOMString text),
- NamedConstructor=<span title="dom-option-tv">Option</span>(DOMString text, DOMString value),
- NamedConstructor=<span title="dom-option-tvd">Option</span>(DOMString text, DOMString value, boolean defaultSelected),
- NamedConstructor=<span title="dom-option-tvds">Option</span>(DOMString text, DOMString value, boolean defaultSelected, boolean selected)]
+<pre class="idl">[NamedConstructor=<span title="dom-option">Option</span>(optional DOMString text, optional DOMString value, optional boolean defaultSelected, optional boolean selected)]
 interface <dfn>HTMLOptionElement</dfn> : <span>HTMLElement</span> {
            attribute boolean <span title="dom-option-disabled">disabled</span>;
   readonly attribute <span>HTMLFormElement</span>? <span title="dom-option-form">form</span>;
@@ -60353,6 +60349,7 @@
 };</pre>
    </dd>
   </dl><!--TOPIC:HTML-->
+<!--CLEANUP-->
 
   <p>The <code>option</code> element <span>represents</span> an option
   in a <code>select</code> element or as part of a list of suggestions
@@ -60423,8 +60420,8 @@
   <span title="concept-option-selectedness">selectedness</span> must
   be set to true.</p>
 
-  <p class="note">The <code title="dom-option-tvd">Option()</code>
-  constructor with three or fewer arguments overrides the initial
+  <p class="note">The <code title="dom-option">Option()</code>
+  constructor, when called with three or fewer arguments, overrides the initial
   state of the <span
   title="concept-option-selectedness">selectedness</span> state to
   always be false even if the third argument is true (implying that a
@@ -60556,26 +60553,23 @@
   attribute must return the same value as the <code title="dom-fae-form">form</code> IDL attribute
   on that <code>select</code> element. Otherwise, it must return null.</p>
 
-  <p>Several constructors are provided for creating <code>HTMLOptionElement</code> objects (in
-  addition to the factory methods from DOM such as <code title="">createElement()</code>): <dfn
-  title="dom-option"><code>Option()</code></dfn>, <dfn title="dom-option-t"><code>Option(<var
-  title="">text</var>)</code></dfn>, <dfn title="dom-option-tv"><code>Option(<var
-  title="">text</var>, <var title="">value</var>)</code></dfn>, <dfn
-  title="dom-option-tvd"><code>Option(<var title="">text</var>, <var title="">value</var>, <var
-  title="">defaultSelected</var>)</code></dfn>, and <dfn title="dom-option-tvds"><code>Option(<var
+<!--CLEANUP-->
+  <p>A constructor is provided for creating <code>HTMLOptionElement</code> objects (in
+  addition to the factory methods from DOM such as <code title="">createElement()</code>):
+  <dfn title="dom-option"><code>Option(<var
   title="">text</var>, <var title="">value</var>, <var title="">defaultSelected</var>, <var
-  title="">selected</var>)</code></dfn>. When invoked as constructors, these must return a new
-  <code>HTMLOptionElement</code> object (a new <code>option</code> element). If the <var
-  title="">text</var> argument is present, the new object must have as its only child a
-  <code>Text</code> node whose data is the value of that argument. If the <var title="">value</var>
+  title="">selected</var>)</code></dfn>. When invoked as a constructor, it must return a new
+  <code>HTMLOptionElement</code> object (a new <code>option</code> element).
+  If the first argument is not the empty string, the new object must have as its only child a
+  <code>Text</code> node whose data is the value of that argument. Otherwise, it must have no children. If the <var title="">value</var>
   argument is present, the new object must have a <code title="attr-option-value">value</code>
   attribute set with the value of the argument as its value. If the <var
-  title="">defaultSelected</var> argument is present and true, the new object must have a <code
+  title="">defaultSelected</var> argument is true, the new object must have a <code
   title="attr-option-selected">selected</code> attribute set with no value. If the <var
-  title="">selected</var> argument is present and true, the new object must have its <span
-  title="concept-option-selectedness">selectedness</span> set to true; otherwise the fourth argument
-  is absent or false, and the <span title="concept-option-selectedness">selectedness</span> must be
-  set to false, even if the <var title="">defaultSelected</var> argument is present and true. The
+  title="">selected</var> argument is true, the new object must have its <span
+  title="concept-option-selectedness">selectedness</span> set to true; otherwise
+  the <span title="concept-option-selectedness">selectedness</span> must be
+  set to false, even if the <var title="">defaultSelected</var> argument is true. The
   element's document must be the <span>active document</span> of the <span>browsing context</span>
   of the <code>Window</code> object on which the interface object of the invoked constructor is
   found.</p>
@@ -97348,9 +97342,10 @@
 
 
   <h4>Disk space</h4>
+<!--CLEANUP-->
 
   <p>User agents should limit the total amount of space allowed for
-  storage areas.</p>
+  storage areas, because hostile authors could otherwise use this feature to exhaust the user's available disk space.</p>
 
   <p>User agents should guard against sites storing data under their
   origin's other affiliated sites, e.g. storing up to the limit in




More information about the Commit-Watchers mailing list