Short URL: http://html5.org/r/2536
| SVN | Bug | Comment | Time (UTC) |
|---|---|---|---|
| 2536 | WebIDL: Put in the anonymous [IndexGetter], [NameCreator], etc, operations. | 2008-12-16 22:52 |
Index: source
===================================================================
--- source (revision 2535)
+++ source (revision 2536)
@@ -5623,35 +5623,29 @@
<p>The <code>DOMStringMap</code> interface represents a set of
name-value pairs. When a <code>DOMStringMap</code> object is
instanced, it is associated with three algorithms, one for getting
- values from names, one for setting names to certain values, and one
- for deleting names.</p>
+ getting the list of name-value pairs, one for setting names to
+ certain values, and one for deleting names.</p>
- <p class="XXX">The names of the methods on this interface are
- temporary and will be fixed when the Web IDL / "Language Bindings
- for DOM Specifications" spec is ready to handle this case.</p>
+ <pre class="idl">[NameCreator, NameDeleter, NameGetter, NameSetter]
+interface <dfn>DOMStringMap</dfn> {};</pre>
- <pre class="idl">interface <dfn>DOMStringMap</dfn> {
- [NameGetter] DOMString <span title="dom-stringmap-XXX1">XXX1</span>(in DOMString name); <!-- XXX DOMB -->
- [NameSetter] void <span title="dom-stringmap-XXX2">XXX2</span>(in DOMString name, in DOMString value); <!-- XXX DOMB -->
- [XXX] boolean <span title="dom-stringmap-XXX3">XXX3</span>(in DOMString name); <!-- XXX DOMB -->
-};</pre>
+ <p>The <span>names of the supported named properties</span> at any
+ instant are the names obtained from the algorithm for getting the
+ list of name-value pairs at that instant.</p>
- <p>The <dfn title="dom-stringmap-XXX1"><code>XXX1(<var
- title="">name</var>)</code></dfn> method must call the algorithm for
- getting values from names, passing <var title="">name</var> as the
- name, and must return the corresponding value, or null if <var
- title="">name</var> has no corresponding value.</p>
+ <p>The value of a property with a name <var title="">name</var> at
+ any instant is the value of the name-value pair with name <var
+ title="">name</var> in the list returned from the algorithm for
+ getting the list of name-value pairs at that instant.</p>
- <p>The <dfn title="dom-stringmap-XXX2"><code>XXX2(<var
- title="">name</var>, <var title="">value</var>)</code></dfn> method
- must call the algorithm for setting names to certain values, passing
- <var title="">name</var> as the name and <var title="">value</var>
- as the value.</p>
+ <p>The behavior for creating a named property and the behavior for
+ setting a named property are both to invoke the algorithm for
+ setting names to certain values, passing <var title="">name</var> as
+ the name and <var title="">value</var> as the value.</p>
- <p>The <dfn title="dom-stringmap-XXX3"><code>XXX3(<var
- title="">name</var>)</code></dfn> method must call the algorithm for
- deleting names, passing <var title="">name</var> as the name, and
- must return true.</p>
+ <p>The behavior for deleting a named property is to invoke the
+ algorithm for deleting names, passing <var title="">name</var> as
+ the name.</p>
<h4>DOM feature strings</h4>
@@ -6933,26 +6927,25 @@
title="attr-data-*">data-*</code> attributes on an element. On
getting, the <code title="dom-dataset">dataset</code> DOM attribute
must return a <code>DOMStringMap</code> object, associated with the
- following three algorithms, which expose these attributes on their
+ following algorithms, which expose these attributes on their
element:</p>
<dl>
- <dt>The algorithm for getting values from names</dt>
+ <dt>The algorithm for getting the list of name-value pairs</dt>
<dd>
<ol>
- <li>Let <var title="">name</var> be the concatenation of the
- string <code title="">data-</code> and the name passed to the
- algorithm, <span>converted to lowercase</span>.</li>
+ <li>Let <var title="">list</var> be an empty list of name-value pairs.</li>
- <li>If the element does not have an attribute with the name <var
- title="">name</var>, then the name has no corresponding value,
- abort.</li>
+ <li>For each content attribute on the element whose first five
+ characters are the string "<code title="">data-</code>", add a
+ name-value pair to <var title="">list</var> whose name is the
+ attribute's name with the first five character removed and whose
+ value is the attribute's value.</li>
- <li>Otherwise, return the value of the attribute with the name
- <var title="">name</var>.</li>
+ <li>Return <var title="">list</var>.</li>
</ol>
</dd>
@@ -6964,7 +6957,7 @@
<li>Let <var title="">name</var> be the concatenation of the
string <code title="">data-</code> and the name passed to the
- algorithm, <span>converted to lowercase</span>.</li>
+ algorithm.</li>
<li>Let <var title="">value</var> be the value passed to the
algorithm.</li>
@@ -6987,7 +6980,7 @@
<li>Let <var title="">name</var> be the concatenation of the
string <code title="">data-</code> and the name passed to the
- algorithm, <span>converted to lowercase</span>.</li>
+ algorithm.</li>
<li>Remove the attribute with the name <var title="">name</var>,
if such an attribute exists. Do nothing otherwise.</li>
@@ -20856,10 +20849,9 @@
readonly attribute <span>CanvasPixelArray</span> <span title="dom-imagedata-data">data</span>;
};
+[IndexGetter, IndexSetter]
interface <dfn>CanvasPixelArray</dfn> {
readonly attribute unsigned long <span title="dom-canvaspixelarray-length">length</span>;
- [IndexGetter] <span>octet</span> <span title="dom-canvaspixelarray-XXX5">XXX5</span>(in unsigned long index); <!-- XXX DOMB -->
- [IndexSetter] void <span title="dom-canvaspixelarray-XXX6">XXX6</span>(in unsigned long index, in octet value); <!-- XXX DOMB -->
};</pre>
<p>The <dfn title="dom-context-2d-canvas"><code>canvas</code></dfn>
@@ -22731,29 +22723,29 @@
attribute of a <code>CanvasPixelArray</code> object must return this
number.</p>
- <p>The <dfn title="dom-canvaspixelarray-XXX5"><code>XXX5(<var
- title="">index</var>)</code></dfn> method must return the value of
- the <var title="">index</var>th component in the array.</p>
+ <p>The object's <span>indices of the supported indexed
+ properties</span> are the numbers in the range 0 .. <span><var
+ title="">h</var>×<var title="">w</var>×4-1</span>.</p>
- <p>The <dfn title="dom-canvaspixelarray-XXX6"><code>XXX6(<var
- title="">index</var>, <var title="">value</var>)</code></dfn> method
- must set the value of the <var title="">index</var>th component in
- the array to <var title="">value</var>. JS <code>undefined</code>
- values must be converted to zero. Other values must first be
- converted to numbers using JavaScript's ToNumber algorithm, and if
- the result is a NaN value, then the value be must converted to
- zero. If the result is less than 0, it must be clamped to zero. If
- the result is more than 255, it must be clamped to 255. If the
- number is not an integer, it should be rounded to the nearest
- integer using the IEEE 754r <i>convertToIntegerTiesToEven</i>
- rounding mode. <a href="#refsECMA262">[ECMA262]</a> <a
+ <p>The value of the <span>corresponding indexed property</span> <var
+ title="">index</var> whenever an indexed property is retrieved is
+ the value of the <var title="">index</var>th component in the
+ array.</p>
+
+ <p>The behavior for setting an indexed property <var
+ title="">index</var> to a value <var title="">value</var> is to set
+ the value of the <var title="">index</var>th component in the array
+ to <var title="">value</var>. JS <code>undefined</code> values must
+ be converted to zero. Other values must first be converted to
+ numbers using JavaScript's ToNumber algorithm, and if the result is
+ a NaN value, then the value be must converted to zero. If the result
+ is less than 0, it must be clamped to zero. If the result is more
+ than 255, it must be clamped to 255. If the number is not an
+ integer, it should be rounded to the nearest integer using the IEEE
+ 754r <i>convertToIntegerTiesToEven</i> rounding mode. <a
+ href="#refsECMA262">[ECMA262]</a> <a
href="#refsIEEE754r">[IEEE754R]</a></p>
- <p class="XXX">The above is not intended to cause these
- methods to get any unusual behaviour, it's just supposed to be the
- normal behaviour for passing values to a method expecting an <code
- title="">octet</code> type.</p>
-
<p class="note">The width and height (<var title="">w</var> and <var
title="">h</var>) might be different from the <var title="">sw</var>
and <var title="">sh</var> arguments to the above methods, e.g. if
@@ -25975,7 +25967,8 @@
<dd><code title="attr-fs-target">target</code></dd>
<dt>DOM interface:</dt>
<dd>
-<pre class="idl">interface <dfn>HTMLFormElement</dfn> : <span>HTMLElement</span> {
+<pre class="idl">[NameGetter, IndexGetter]
+interface <dfn>HTMLFormElement</dfn> : <span>HTMLElement</span> {
attribute DOMString <span title="dom-form-accept-charset">accept-charset</span>;
attribute DOMString <span title="dom-fs-action">action</span>;
attribute DOMString <span title="dom-fs-enctype">enctype</span>;
@@ -25986,8 +25979,6 @@
readonly attribute <span>HTMLFormControlsCollection</span> <span title="dom-form-elements">elements</span>;
readonly attribute long <span title="dom-form-length">length</span>;
- [IndexGetter] <span>HTMLElement</span> <span title="dom-form-XXX7">XXX7</span>(in unsigned long index);
- [NameGetter] Object <span title="dom-form-XXX8">XXX8</span>(in DOMString name);
void <span title="dom-form-submit">submit</span>();
void <span title="dom-form-reset">reset</span>();
@@ -26043,27 +26034,29 @@
for historical reasons, be excluded from this particular
collection.</p>
- <p>The <dfn title="dom-form-length"><code>length</code></dfn> DOM
- attribute must return the number of nodes <span title="represented
- by the collection">represented</span> by the <code
- title="dom-form-elements">elements</code> collection.</p>
+ <p>The <code title="dom-form-elements">elements</code> collection is
+ also mirrored on the <code>HTMLFormElement</code> object. The <dfn
+ title="dom-form-length"><code>length</code></dfn> DOM attribute must
+ return the number of nodes <span title="represented by the
+ collection">represented</span> by the <code
+ title="dom-form-elements">elements</code> collection. The
+ <span>indices of the supported indexed properties</span> at any
+ instant are the indicies supported by the object returned by the
+ <code title="dom-form-elements">elements</code> attribute at that
+ instant. The value of the <span>corresponding indexed
+ property</span> whenever an indexed property is retrieved is the
+ value of the <span>corresponding indexed property</span> on the
+ object returned by the <code
+ title="dom-form-elements">elements</code> attribute. The <span>names
+ of the supported named properties</span> at any instant are the
+ names supported by the object returned by the <code
+ title="dom-form-elements">elements</code> attribute at that
+ instant. The value of a property with a name <var
+ title="">name</var> at any instant is the property with the same
+ name on the object returned by the <code
+ title="dom-form-elements">elements</code> attribute at the same
+ instant.</p>
- <!-- XXX7 and XXX8: in IE these are called item and namedItem, but
- they have deep magic involved to resolve name clashes with form
- controls of those names. In other browsers, they are anonymous. -->
-
- <p>The <dfn title="dom-form-XXX7"><code>XXX7()</code></dfn> method
- must return the value that would be returned by the <code
- title="dom-HTMLFormControlsCollection-item">item()</code> method of
- the <code title="dom-form-elements">elements</code> collection if it
- was invoked with the same arguments.</p>
-
- <p>The <dfn title="dom-form-XXX8"><code>XXX8()</code></dfn> method
- must return the value that would be returned by the <code
- title="dom-HTMLFormControlsCollection-namedItem">namedItem()</code>
- method of the <code title="dom-form-elements">elements</code>
- collection if it was invoked with the same arguments.</p>
-
<p>The <dfn title="dom-form-submit"><code>submit()</code></dfn>
method, when invoked, must <span
title="concept-form-submit">submit</span> the <code>form</code>
@@ -30890,7 +30883,8 @@
<dd><code title="attr-select-size">size</code></dd>
<dt>DOM interface:</dt>
<dd>
-<pre class="idl">interface <dfn>HTMLSelectElement</dfn> : <span>HTMLElement</span> {
+<pre class="idl">[IndexGetter]
+interface <dfn>HTMLSelectElement</dfn> : <span>HTMLElement</span> {
attribute boolean <span title="dom-fe-autofocus">autofocus</span>;
attribute boolean <span title="dom-fe-disabled">disabled</span>;
readonly attribute <span>HTMLFormElement</span> <span title="dom-fae-form">form</span>;
@@ -30902,7 +30896,6 @@
readonly attribute <span>HTMLOptionsCollection</span> <span title="dom-select-options">options</span>;
attribute unsigned long <span title="dom-select-length">length</span>;
- [IndexGetter] <span>HTMLElement</span> <span title="dom-select-XXX9">XXX9</span>(in unsigned long index);
void <span title="dom-select-add">add</span>(in <span>HTMLElement</span> element, in <span>HTMLElement</span> before);
void <span title="dom-select-add">add</span>(in <span>HTMLElement</span> element, in long before);
void <span title="dom-select-remove">remove</span>(in long index);
@@ -31091,7 +31084,14 @@
act like their namesake methods on that same
<code>HTMLOptionsCollection</code> object.</p>
- <!-- XXX9 is blocked on WebIDL -->
+ <p>The <span>indices of the supported indexed properties</span> at
+ any instant are the indicies supported by the object returned by the
+ <code title="dom-select-options">options</code> attribute at that
+ instant. The value of the <span>corresponding indexed
+ property</span> whenever an indexed property is retrieved is the
+ value of the <span>corresponding indexed property</span> on the
+ object returned by the <code
+ title="dom-select-options">options</code> attribute.</p>
<p>The <dfn
title="dom-select-selectedOptions"><code>selectedOptions</code></dfn>
@@ -37320,7 +37320,8 @@
view">default views</span> must also implement the
<code>Window</code> and <code>EventTarget</code> interfaces.</p>
- <pre class="idl">[NoInterfaceObject] interface <dfn>Window</dfn> {
+ <pre class="idl">[NoInterfaceObject, IndexGetter]
+interface <dfn>Window</dfn> {
// the current browsing context
readonly attribute <span>Window</span> <span title="dom-window">window</span>;
readonly attribute <span>Window</span> <span title="dom-self">self</span>;
@@ -37333,7 +37334,6 @@
// other browsing contexts
readonly attribute <span>Window</span> <span title="dom-frames">frames</span>;
readonly attribute unsigned long <span title="dom-length">length</span>;
- [IndexGetter] <span>Window</span> <span title="dom-XXX4">XXX4</span>(in unsigned long index); <!-- XXX DOMB -->
readonly attribute <span>Window</span> <span title="dom-top">top</span>;
readonly attribute <span>Window</span> <span title="dom-opener">opener</span>;
readonly attribute <span>Window</span> <span title="dom-parent">parent</span>;
@@ -37451,7 +37451,8 @@
<li>The <code title="dom-frames">frames</code> attribute
- <li>The <code title="dom-XXX4">XXX4</code> method
+ <li>Any <span title="corresponding indexed property">corresponding
+ indexed properties</span>
</ul>
@@ -37551,12 +37552,19 @@
contexts</span> of the <span title="active document">active</span>
<code>Document</code>.</p>
- <p>The <dfn title="dom-XXX4"><code>XXX4(<var
- title="">index</var>)</code></dfn> method must return the <var
+ <p>The <span>indices of the supported indexed properties</span> on the <code>Window</code> object at
+ any instant are the numbers in the range 0 .. <var title="">n</var>, where <var title="">n</var> is the
+ number of <span title="child browsing context">child browsing
+ contexts</span> of the <span title="active document">active</span>
+ <code>Document</code>.</p>
+
+ <p>The value of a <span>corresponding indexed property</span> <var
+ title="">index</var> whenever an indexed property on a
+ <code>Window</code> object is retrieved is the <var
title="">index</var>th <span>child browsing context</span> of the
<span title="active document">active</span> <code>Document</code>,
sorted in document order of the elements nesting those browsing
- contexts.</p> <!-- XXX DOMB -->
+ contexts.</p>
@@ -50591,10 +50599,10 @@
<li>
- <li><p>Let <var title="">message clone</var> be the result of
+ <p>Let <var title="">message clone</var> be the result of
obtaining a <span>structured clone</span> of the <var
title="">message</var> argument. If this throws an exception, then
- throw that exception and abort these steps.</p></li>
+ throw that exception and abort these steps.</p>
</li>