Skip to content

Commit

Permalink
[e] (0) Option constructor: clean up to use more WebIDL features, beh…
Browse files Browse the repository at this point in the history
…ave more like IE for the first argument. Add some rationale for Web Storage disk quota suggestions.

Affected topics: DOM APIs, HTML

git-svn-id: http://svn.whatwg.org/webapps@7785 340c8d12-0b0e-0410-8428-c7bf67bfef74
  • Loading branch information
Hixie committed Apr 1, 2013
1 parent 2aa864e commit 9e0c937
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 56 deletions.
32 changes: 16 additions & 16 deletions complete.html
Expand Up @@ -50858,11 +50858,7 @@ <h4 id=the-option-element><span class=secno>4.10.12 </span>The <dfn><code>option
<dd><code title=attr-option-value><a href=#attr-option-value>value</a></code> &mdash; Value to be used for <a href=#form-submission>form submission</a></dd> <dd><code title=attr-option-value><a href=#attr-option-value>value</a></code> &mdash; 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--> <dt><a href=#element-dfn-dom title=element-dfn-dom>DOM interface</a>:</dt><!--TOPIC:DOM APIs-->
<dd> <dd>
<pre class=idl>[NamedConstructor=<a href=#dom-option title=dom-option>Option</a>(), <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)]
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)]
interface <dfn id=htmloptionelement>HTMLOptionElement</dfn> : <a href=#htmlelement>HTMLElement</a> { interface <dfn id=htmloptionelement>HTMLOptionElement</dfn> : <a href=#htmlelement>HTMLElement</a> {
attribute boolean <a href=#dom-option-disabled title=dom-option-disabled>disabled</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>; readonly attribute <a href=#htmlformelement>HTMLFormElement</a>? <a href=#dom-option-form title=dom-option-form>form</a>;
Expand All @@ -50875,7 +50871,7 @@ <h4 id=the-option-element><span class=secno>4.10.12 </span>The <dfn><code>option
readonly attribute long <a href=#dom-option-index title=dom-option-index>index</a>; readonly attribute long <a href=#dom-option-index title=dom-option-index>index</a>;
};</pre> };</pre>
</dd> </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-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> in a <code><a href=#the-datalist-element>datalist</a></code> element.</p>


Expand Down Expand Up @@ -50929,8 +50925,8 @@ <h4 id=the-option-element><span class=secno>4.10.12 </span>The <dfn><code>option
<a href=#concept-option-selectedness title=concept-option-selectedness>selectedness</a> must <a href=#concept-option-selectedness title=concept-option-selectedness>selectedness</a> must
be set to true.</p> be set to true.</p>


<p class=note>The <code title=dom-option-tvd><a href=#dom-option-tvd>Option()</a></code> <p class=note>The <code title=dom-option><a href=#dom-option>Option()</a></code>
constructor with three or fewer arguments overrides the initial 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 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 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 <code title=attr-option-selected><a href=#attr-option-selected>selected</a></code> attribute is to
Expand Down Expand Up @@ -51048,14 +51044,17 @@ <h4 id=the-option-element><span class=secno>4.10.12 </span>The <dfn><code>option
attribute must return the same value as the <code title=dom-fae-form><a href=#dom-fae-form>form</a></code> IDL attribute 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> 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 <!--CLEANUP-->
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 <p>A constructor is provided for creating <code><a href=#htmloptionelement>HTMLOptionElement</a></code> objects (in
<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 addition to the factory methods from DOM such as <code title="">createElement()</code>):
<code><a href=#text>Text</a></code> node whose data is the value of that argument. If the <var title="">value</var> <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> 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 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
is absent or false, and the <a href=#concept-option-selectedness title=concept-option-selectedness>selectedness</a> must be 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 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> 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 of the <code><a href=#window>Window</a></code> object on which the interface object of the invoked constructor is
found.</p> found.</p>
Expand Down Expand Up @@ -83169,9 +83168,10 @@ <h4 id=threads><span class=secno>11.2.5 </span>Threads</h4>




<h3 id=disk-space-0><span class=secno>11.3 </span>Disk space</h3> <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 <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 <p>User agents should guard against sites storing data under their
origin's other affiliated sites, e.g. storing up to the limit in origin's other affiliated sites, e.g. storing up to the limit in
Expand Down
32 changes: 16 additions & 16 deletions index
Expand Up @@ -50858,11 +50858,7 @@ You cannot submit this form when the field is incorrect.</samp></pre>
<dd><code title=attr-option-value><a href=#attr-option-value>value</a></code> &mdash; Value to be used for <a href=#form-submission>form submission</a></dd> <dd><code title=attr-option-value><a href=#attr-option-value>value</a></code> &mdash; 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--> <dt><a href=#element-dfn-dom title=element-dfn-dom>DOM interface</a>:</dt><!--TOPIC:DOM APIs-->
<dd> <dd>
<pre class=idl>[NamedConstructor=<a href=#dom-option title=dom-option>Option</a>(), <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)]
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)]
interface <dfn id=htmloptionelement>HTMLOptionElement</dfn> : <a href=#htmlelement>HTMLElement</a> { interface <dfn id=htmloptionelement>HTMLOptionElement</dfn> : <a href=#htmlelement>HTMLElement</a> {
attribute boolean <a href=#dom-option-disabled title=dom-option-disabled>disabled</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>; readonly attribute <a href=#htmlformelement>HTMLFormElement</a>? <a href=#dom-option-form title=dom-option-form>form</a>;
Expand All @@ -50875,7 +50871,7 @@ interface <dfn id=htmloptionelement>HTMLOptionElement</dfn> : <a href=#htmleleme
readonly attribute long <a href=#dom-option-index title=dom-option-index>index</a>; readonly attribute long <a href=#dom-option-index title=dom-option-index>index</a>;
};</pre> };</pre>
</dd> </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-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> in a <code><a href=#the-datalist-element>datalist</a></code> element.</p>


Expand Down Expand Up @@ -50929,8 +50925,8 @@ interface <dfn id=htmloptionelement>HTMLOptionElement</dfn> : <a href=#htmleleme
<a href=#concept-option-selectedness title=concept-option-selectedness>selectedness</a> must <a href=#concept-option-selectedness title=concept-option-selectedness>selectedness</a> must
be set to true.</p> be set to true.</p>


<p class=note>The <code title=dom-option-tvd><a href=#dom-option-tvd>Option()</a></code> <p class=note>The <code title=dom-option><a href=#dom-option>Option()</a></code>
constructor with three or fewer arguments overrides the initial 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 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 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 <code title=attr-option-selected><a href=#attr-option-selected>selected</a></code> attribute is to
Expand Down Expand Up @@ -51048,14 +51044,17 @@ interface <dfn id=htmloptionelement>HTMLOptionElement</dfn> : <a href=#htmleleme
attribute must return the same value as the <code title=dom-fae-form><a href=#dom-fae-form>form</a></code> IDL attribute 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> 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 <!--CLEANUP-->
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 <p>A constructor is provided for creating <code><a href=#htmloptionelement>HTMLOptionElement</a></code> objects (in
<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 addition to the factory methods from DOM such as <code title="">createElement()</code>):
<code><a href=#text>Text</a></code> node whose data is the value of that argument. If the <var title="">value</var> <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> 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 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
is absent or false, and the <a href=#concept-option-selectedness title=concept-option-selectedness>selectedness</a> must be 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 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> 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 of the <code><a href=#window>Window</a></code> object on which the interface object of the invoked constructor is
found.</p> found.</p>
Expand Down Expand Up @@ -83169,9 +83168,10 @@ dictionary <dfn id=storageeventinit>StorageEventInit</dfn> : <a href=#eventinit>




<h3 id=disk-space-0><span class=secno>11.3 </span>Disk space</h3> <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 <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 <p>User agents should guard against sites storing data under their
origin's other affiliated sites, e.g. storing up to the limit in origin's other affiliated sites, e.g. storing up to the limit in
Expand Down

0 comments on commit 9e0c937

Please sign in to comment.