Skip to content

Commit

Permalink
Editorial: formalize reflect's default value
Browse files Browse the repository at this point in the history
And rename some number-related options to be less verbose and more consistent.

Fixes #8926 and fixes #8927.
  • Loading branch information
annevk authored Feb 27, 2023
1 parent b80d605 commit a32ab9b
Showing 1 changed file with 54 additions and 49 deletions.
103 changes: 54 additions & 49 deletions source
Original file line number Diff line number Diff line change
Expand Up @@ -7916,7 +7916,8 @@ a.setAttribute('href', 'https://example.com/'); // change the content attribute
attributes</span>.

<p>If a <span>reflected IDL attribute</span> has the type <code data-x="idl-long">long</code>,
optionally <dfn>limited to only non-negative numbers</dfn>:
optionally <dfn>limited to only non-negative numbers</dfn> and optionally with a <dfn>default
value</dfn> <var>defaultValue</var>:

<ul>
<li>
Expand All @@ -7941,8 +7942,8 @@ a.setAttribute('href', 'https://example.com/'); // change the content attribute
</ol>
</li>

<li><p>If the <span>reflected IDL attribute</span> has a default value, then return
it.</p></li>
<li><p>If the <span>reflected IDL attribute</span> has a <span>default value</span>, then
return <var>defaultValue</var>.</p></li>

<li><p>If the <span>reflected IDL attribute</span> is <span>limited to only non-negative
numbers</span>, then return &#x2212;1.</p></li>
Expand All @@ -7967,9 +7968,12 @@ a.setAttribute('href', 'https://example.com/'); // change the content attribute
</ul>

<p>If a <span>reflected IDL attribute</span> has the type <code
data-x="idl-unsigned-long">unsigned long</code>, optionally <dfn>limited to only non-negative
numbers greater than zero</dfn>, <dfn>limited to only non-negative numbers greater than zero with
fallback</dfn>, or <dfn>clamped to the range</dfn> [<var>clampedMin</var>, <var>clampedMax</var>]:
data-x="idl-unsigned-long">unsigned long</code>, optionally <dfn
id="limited-to-only-non-negative-numbers-greater-than-zero">limited to only positive
numbers</dfn>, <dfn
id="limited-to-only-non-negative-numbers-greater-than-zero-with-fallback">limited to only positive
numbers with fallback</dfn>, or <dfn>clamped to the range</dfn> [<var>clampedMin</var>,
<var>clampedMax</var>], and optionally with a <span>default value</span> <var>defaultValue</var>:

<ul>
<li>
Expand All @@ -7981,9 +7985,9 @@ a.setAttribute('href', 'https://example.com/'); // change the content attribute

<li><p>Let <var>minimum</var> be 0.</p></li>

<li><p>If the <span>reflected IDL attribute</span> is <span>limited to only non-negative
numbers greater than zero</span> or <span>limited to only non-negative numbers greater than
zero with fallback</span>, then set <var>minimum</var> to 1.</p></li>
<li><p>If the <span>reflected IDL attribute</span> is <span>limited to only positive
numbers</span> or <span>limited to only positive numbers with fallback</span>, then set
<var>minimum</var> to 1.</p></li>

<li><p>If the <span>reflected IDL attribute</span> is <span>clamped to the range</span>, then
set <var>minimum</var> to <var>clampedMin</var>.</p></li>
Expand Down Expand Up @@ -8016,8 +8020,8 @@ a.setAttribute('href', 'https://example.com/'); // change the content attribute
</ol>
</li>

<li><p>If the <span>reflected IDL attribute</span> has a default value, then return
it.</p></li>
<li><p>If the <span>reflected IDL attribute</span> has a <span>default value</span>, then
return <var>defaultValue</var>.</p></li>

<li><p>Return <var>minimum</var>.</p></li>
</ol>
Expand All @@ -8027,20 +8031,20 @@ a.setAttribute('href', 'https://example.com/'); // change the content attribute
<p>The setter steps are:</p>

<ol>
<li><p>If the <span>reflected IDL attribute</span> is <span>limited to only non-negative
numbers greater than zero</span> and the given value is 0, then throw an
<li><p>If the <span>reflected IDL attribute</span> is <span>limited to only positive
numbers</span> and the given value is 0, then throw an
<span>"<code>IndexSizeError</code>"</span> <code>DOMException</code>.</p></li>

<li><p>Let <var>minimum</var> be 0.</p></li>

<li><p>If the <span>reflected IDL attribute</span> is <span>limited to only non-negative
numbers greater than zero</span> or <span>limited to only non-negative numbers greater than
zero with fallback</span>, then set <var>minimum</var> to 1.</p></li>
<li><p>If the <span>reflected IDL attribute</span> is <span>limited to only positive
numbers</span> or <span>limited to only positive numbers with fallback</span>, then set
<var>minimum</var> to 1.</p></li>

<li><p>Let <var>newValue</var> be <var>minimum</var>.</p></li>

<li><p>If the <span>reflected IDL attribute</span> has a default value, then set
<var>newValue</var> to it.</p></li>
<li><p>If the <span>reflected IDL attribute</span> has a <span>default value</span>, then set
<var>newValue</var> to <var>defaultValue</var>.</p></li>

<li><p>If the given value is in the range <var>minimum</var> to 2147483647, inclusive,
then set <var>newValue</var> to it.</p></li>
Expand All @@ -8060,7 +8064,8 @@ a.setAttribute('href', 'https://example.com/'); // change the content attribute
of 4294967295 -->

<p>If a <span>reflected IDL attribute</span> has the type <code data-x="idl-double">double</code>,
optionally <dfn>limited to numbers greater than zero</dfn>:
optionally <span id="limited-to-numbers-greater-than-zero">limited to only positive numbers</span>
and optionally with a <span>default value</span> <var>defaultValue</var>:

<ul>
<li>
Expand All @@ -8082,13 +8087,13 @@ a.setAttribute('href', 'https://example.com/'); // change the content attribute
<var>parsedValue</var>.</p></li>

<li><p>If <var>parsedValue</var> is not an error and the <span>reflected IDL attribute</span>
is not <span>limited to numbers greater than zero</span>, then return
is not <span>limited to only positive numbers</span>, then return
<var>parsedValue</var>.</p></li>
</ol>
</li>

<li><p>If the <span>reflected IDL attribute</span> has a default value, then return
it.</p></li>
<li><p>If the <span>reflected IDL attribute</span> has a <span>default value</span>, then
return <var>defaultValue</var>.</p></li>

<li><p>Return 0.</p></li>
</ol>
Expand All @@ -8099,8 +8104,8 @@ a.setAttribute('href', 'https://example.com/'); // change the content attribute
<p>The setter steps are:</p>

<ol>
<li><p>If the <span>reflected IDL attribute</span> is <span>limited to numbers greater than
zero</span> and the given value is not greater than 0, then return.</p></li>
<li><p>If the <span>reflected IDL attribute</span> is <span>limited to only positive
numbers</span> and the given value is not greater than 0, then return.</p></li>

<li><p>Run <span>this</span>'s <span>set the content attribute</span> with the given value,
converted to the <span>best representation of the number as a floating-point
Expand Down Expand Up @@ -19854,8 +19859,8 @@ interface <dfn interface>HTMLOListElement</dfn> : <span>HTMLElement</span> {
attributes must <span>reflect</span> the respective content attributes of the same name.</p>

<p>The <dfn attribute for="HTMLOListElement"><code data-x="dom-ol-start">start</code></dfn> IDL
attribute must <span>reflect</span> the content attribute of the same name, with a default value
of 1.</p>
attribute must <span>reflect</span> the content attribute of the same name, with a <span>default
value</span> of 1.</p>

<p class="note">This means that the <code data-x="dom-ol-start">start</code> IDL attribute does
not necessarily match the list's <span data-x="concept-ol-start">starting value</span>, in cases
Expand Down Expand Up @@ -42108,7 +42113,7 @@ interface <dfn interface>HTMLTableColElement</dfn> : <span>HTMLElement</span> {

<p>The <dfn attribute for="HTMLTableColElement"><code data-x="dom-colgroup-span">span</code></dfn>
IDL attribute must <span>reflect</span> the content attribute of the same name. It is
<span>clamped to the range</span> [1, 1000], and its default value is 1.</p>
<span>clamped to the range</span> [1, 1000], and its <span>default value</span> is 1.</p>

</div>

Expand Down Expand Up @@ -42877,12 +42882,12 @@ interface <dfn interface>HTMLTableCellElement</dfn> : <span>HTMLElement</span> {
<p>The <dfn attribute for="HTMLTableCellElement"><code
data-x="dom-tdth-colSpan">colSpan</code></dfn> IDL attribute must <span>reflect</span> the <code
data-x="attr-tdth-colspan">colspan</code> content attribute. It is <span>clamped to the
range</span> [1, 1000], and its default value is 1.</p>
range</span> [1, 1000], and its <span>default value</span> is 1.</p>

<p>The <dfn attribute for="HTMLTableCellElement"><code
data-x="dom-tdth-rowSpan">rowSpan</code></dfn> IDL attribute must <span>reflect</span> the <code
data-x="attr-tdth-rowspan">rowspan</code> content attribute. It is <span>clamped to the
range</span> [0, 65534], and its default value is 1.</p>
range</span> [0, 65534], and its <span>default value</span> is 1.</p>

<p>The <dfn attribute for="HTMLTableCellElement"><code
data-x="dom-tdth-headers">headers</code></dfn> IDL attribute must <span>reflect</span> the content
Expand Down Expand Up @@ -50467,8 +50472,8 @@ ldh-str = &lt; as defined in <a href="https://www.rfc-editor.org/rfc/rfc10
non-negative integers</span>, and if the result is a number greater than zero, then the user agent
should ensure that at least that many characters are visible.</p>

<p>The <code data-x="dom-input-size">size</code> IDL attribute is <span>limited to only
non-negative numbers greater than zero</span> and has a default value of 20.</p>
<p>The <code data-x="dom-input-size">size</code> IDL attribute is <span>limited to only positive
numbers</span> and has a <span>default value</span> of 20.</p>

</div>

Expand Down Expand Up @@ -52561,10 +52566,10 @@ interface <dfn interface>HTMLSelectElement</dfn> : <span>HTMLElement</span> {
data-x="dom-select-required">required</code></dfn>, and <dfn attribute
for="HTMLSelectElement"><code data-x="dom-select-size">size</code></dfn> IDL attributes must
<span>reflect</span> the respective content attributes of the same name. The <code
data-x="dom-select-size">size</code> IDL attribute has a default value of zero.</p> <!-- see bug
12288 for compat reasons why .size allows zero (it's not limited to values greater than zero) even
though that value really makes no sense
-->
data-x="dom-select-size">size</code> IDL attribute has a <span>default value</span> of 0.</p>
<!-- see https://www.w3.org/Bugs/Public/show_bug.cgi?id=12288 for compat reasons why .size allows
0 (it's not limited to values greater than zero) even though that value really makes no sense
-->

<p class="note">For historical reasons, the default value of the <code
data-x="dom-select-size">size</code> IDL attribute does not return the actual size used, which, in
Expand Down Expand Up @@ -53508,12 +53513,12 @@ interface <dfn interface>HTMLTextAreaElement</dfn> : <span>HTMLElement</span> {
attribute for="HTMLTextAreaElement"><code data-x="dom-textarea-wrap">wrap</code></dfn> IDL
attributes must <span>reflect</span> the respective content attributes of the same name. The <code
data-x="dom-textarea-cols">cols</code> and <code data-x="dom-textarea-rows">rows</code> attributes
are <span>limited to only non-negative numbers greater than zero with fallback</span>. The <code
data-x="dom-textarea-cols">cols</code> IDL attribute's default value is 20. The <code
data-x="dom-textarea-rows">rows</code> IDL attribute's default value is 2. The <dfn attribute
for="HTMLTextAreaElement"><code data-x="dom-textarea-dirName">dirName</code></dfn> IDL attribute
must <span>reflect</span> the <code data-x="attr-fe-dirname">dirname</code> content attribute. The
<dfn attribute for="HTMLTextAreaElement"><code
are <span>limited to only positive numbers with fallback</span>. The <code
data-x="dom-textarea-cols">cols</code> IDL attribute's <span>default value</span> is 20. The <code
data-x="dom-textarea-rows">rows</code> IDL attribute's <span>default value</span> is 2. The <dfn
attribute for="HTMLTextAreaElement"><code data-x="dom-textarea-dirName">dirName</code></dfn> IDL
attribute must <span>reflect</span> the <code data-x="attr-fe-dirname">dirname</code> content
attribute. The <dfn attribute for="HTMLTextAreaElement"><code
data-x="dom-textarea-maxLength">maxLength</code></dfn> IDL attribute must <span>reflect</span> the
<code data-x="attr-textarea-maxlength">maxlength</code> content attribute, <span>limited to only
non-negative numbers</span>. The <dfn attribute for="HTMLTextAreaElement"><code
Expand Down Expand Up @@ -53990,8 +53995,8 @@ interface <dfn interface>HTMLProgressElement</dfn> : <span>HTMLElement</span> {

<p>The <dfn attribute for="HTMLProgressElement"><code data-x="dom-progress-max">max</code></dfn>
IDL attribute must <span>reflect</span> the content attribute of the same name, <span>limited to
numbers greater than zero</span>. The default value for <code data-x="dom-progress-max">max</code>
is 1.0.</p>
only positive numbers</span>. The <span>default value</span> for <code
data-x="dom-progress-max">max</code> is 1.0.</p>

<p>The <code data-x="dom-lfe-labels">labels</code> IDL attribute provides a list of the element's
<code>label</code>s.</p>
Expand Down Expand Up @@ -77532,11 +77537,11 @@ partial interface <span id="NavigatorUserActivation-partial">Navigator</span> {

<p>The <dfn attribute for="HTMLOrSVGElement"><code data-x="dom-tabIndex">tabIndex</code></dfn> IDL
attribute must <span>reflect</span> the value of the <code data-x="attr-tabindex">tabindex</code>
content attribute. The default value is 0 if the element is an <code>a</code>, <code>area</code>,
<code>button</code>, <code>frame</code>, <code>iframe</code>, <code>input</code>,
<code>object</code>, <code>select</code>, <code>textarea</code>, or <span>SVG
content attribute. The <span>default value</span> is 0 if the element is an <code>a</code>,
<code>area</code>, <code>button</code>, <code>frame</code>, <code>iframe</code>,
<code>input</code>, <code>object</code>, <code>select</code>, <code>textarea</code>, or <span>SVG
<code>a</code></span> element, or is a <code>summary</code> element that is a <span>summary for
its parent details</span>. The default value is &#x2212;1 otherwise.</p>
its parent details</span>. The <span>default value</span> is &#x2212;1 otherwise.</p>

<p class="note">The varying default value based on element type is a historical artifact.</p>

Expand Down Expand Up @@ -126802,12 +126807,12 @@ interface <dfn interface>HTMLMarqueeElement</dfn> : <span>HTMLElement</span> {
<p>The <dfn attribute for="HTMLMarqueeElement"><code
data-x="dom-marquee-scrollAmount">scrollAmount</code></dfn> IDL attribute must
<span>reflect</span> the <code undefined data-x="attr-marquee-scrollamount">scrollamount</code>
content attribute. The default value is 6.</p>
content attribute. The <span>default value</span> is 6.</p>

<p>The <dfn attribute for="HTMLMarqueeElement"><code
data-x="dom-marquee-scrollDelay">scrollDelay</code></dfn> IDL attribute must <span>reflect</span>
the <code undefined data-x="attr-marquee-scrolldelay">scrolldelay</code> content attribute. The
default value is 85.</p>
<span>default value</span> is 85.</p>

<p>The <dfn attribute for="HTMLMarqueeElement"><code
data-x="dom-marquee-trueSpeed">trueSpeed</code></dfn> IDL attribute must <span>reflect</span> the
Expand Down

0 comments on commit a32ab9b

Please sign in to comment.