Skip to content

Commit 7074670

Browse files
committed
Add some clarity to spec prose defining new extended attributes
1 parent b0d8a24 commit 7074670

File tree

1 file changed

+54
-51
lines changed

1 file changed

+54
-51
lines changed

source

Lines changed: 54 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -8802,77 +8802,80 @@ a.setAttribute('href', 'https://example.com/'); // change the content attribute
88028802

88038803
<h4>Using reflect via IDL extended attributes</h4>
88048804

8805-
<p>To enable improved usage of <span data-x="reflect">reflection</span>, we introduce the <dfn
8806-
extended-attribute data-lt="Reflect" data-x="xattr-Reflect"><code>[Reflect]</code></dfn>, <dfn
8807-
extended-attribute data-lt="ReflectSetter"
8808-
data-x="xattr-ReflectSetter"><code>[ReflectSetter]</code></dfn>, <dfn extended-attribute
8809-
data-lt="ReflectURL" data-x="xattr-ReflectURL"><code>[ReflectURL]</code></dfn>, <dfn
8810-
extended-attribute data-lt="ReflectNonNegative"
8805+
<p>To enable improved usage of <span data-x="reflect">reflection</span>, we introduce multiple new
8806+
IDL <span data-x="extended attribute">extended attributes</span>. <dfn extended-attribute
8807+
data-lt="Reflect" data-x="xattr-Reflect"><code>[Reflect]</code></dfn>, <dfn extended-attribute
8808+
data-lt="ReflectSetter" data-x="xattr-ReflectSetter"><code>[ReflectSetter]</code></dfn>, <dfn
8809+
extended-attribute data-lt="ReflectURL" data-x="xattr-ReflectURL"><code>[ReflectURL]</code></dfn>,
8810+
<dfn extended-attribute data-lt="ReflectNonNegative"
88118811
data-x="xattr-ReflectNonNegative"><code>[ReflectNonNegative]</code></dfn>, <dfn extended-attribute
8812-
data-lt="ReflectPositive" data-x="xattr-ReflectPositive"><code>[ReflectPositive]</code></dfn>,
8812+
data-lt="ReflectPositive" data-x="xattr-ReflectPositive"><code>[ReflectPositive]</code></dfn>, and
88138813
<dfn extended-attribute data-lt="ReflectPositiveWithFallback"
8814-
data-x="xattr-ReflectPositiveWithFallback"><code>[ReflectPositiveWithFallback]</code></dfn>, <dfn
8815-
extended-attribute data-lt="ReflectRange"
8816-
data-x="xattr-ReflectRange"><code>[ReflectRange]</code></dfn>, and <dfn extended-attribute
8817-
data-lt="ReflectDefault" data-x="xattr-ReflectDefault"><code>[ReflectDefault]</code></dfn> IDL
8818-
<span data-x="extended attribute">extended attributes</span>.</p>
8814+
data-x="xattr-ReflectPositiveWithFallback"><code>[ReflectPositiveWithFallback]</code></dfn> all
8815+
trigger <span data-x="reflect">reflection</span>. These must either take no arguments, or take a
8816+
string; they must not appear on anything other than an interface member attribute; and only one of
8817+
these can be used at a time.</p>
88198818

8820-
<p>The <code data-x="xattr-Reflect">[Reflect]</code>, <code
8821-
data-x="xattr-ReflectSetter">[ReflectSetter]</code>, <code
8822-
data-x="xattr-ReflectURL">[ReflectURL]</code>, <code
8823-
data-x="xattr-ReflectNonNegative">[ReflectNonNegative]</code>, <code
8824-
data-x="xattr-ReflectPositive">[ReflectPositive]</code>, <code
8825-
data-x="xattr-ReflectPositiveWithFallback">[ReflectPositiveWithFallback]</code> <span>extended
8826-
attribute</span>s must either take no arguments, or take a string. They must not appear on
8827-
anything other than an interface member attribute.</p>
8819+
<p>For one of these primary reflection <span data-x="extended attribute">extended
8820+
attributes</span>, its <span>reflected content attribute name</span> is the string value it takes,
8821+
if one is provided, or the IDL attribute name otherwise.</p>
88288822

88298823
<p>IDL attributes with the <code data-x="xattr-Reflect">[Reflect]</code> <span>extended
8830-
attribute</span> must <span>reflect</span> the content attribute of the name provided by <code
8831-
data-x="xattr-Reflect">[Reflect]</code> or the IDL attribute name if none is provided.</p>
8824+
attribute</span> must <span>reflect</span> <code data-x="xattr-Reflect">[Reflect]</code>'s
8825+
<span>reflected content attribute name</span>.</p>
88328826

88338827
<p>IDL attributes with the <code data-x="xattr-ReflectSetter">[ReflectSetter]</code>
8834-
<span>extended attribute</span> on setting must <span>reflect</span> the content attribute of the
8835-
name provided by <code data-x="xattr-ReflectSetter">[ReflectSetter]</code> or the IDL attribute
8836-
name if none is provided.</p>
8828+
<span>extended attribute</span> on setting must <span>reflect</span> <code
8829+
data-x="xattr-ReflectSetter">[ReflectSetter]</code>'s <span>reflected content attribute
8830+
name</span>.</p>
8831+
8832+
<p>The <code data-x="xattr-ReflectURL">[ReflectURL]</code> <span>extended attribute</span> must
8833+
only appear on attributes with a type of <code data-x="idl-USVString">USVString</code>.</p>
88378834

88388835
<p>IDL attributes with the <code data-x="xattr-ReflectURL">[ReflectURL]</code> <span>extended
8839-
attribute</span> must <span>reflect</span>, <span data-x="treated as a URL">as a URL</span>, the
8840-
content attribute of the name provided by <code data-x="xattr-ReflectURL">[ReflectURL]</code> or
8841-
the IDL attribute name if none is provided.</p>
8836+
attribute</span> must <span>reflect</span>, <span data-x="treated as a URL">as a URL</span>, <code
8837+
data-x="xattr-ReflectURL">[ReflectURL]</code>'s <span>reflected content attribute name</span>.</p>
88428838

88438839
<p>The <code data-x="xattr-ReflectNonNegative">[ReflectNonNegative]</code> <span>extended
8844-
attribute</span> must only appear on interface member attributes with a type of <code
8840+
attribute</span> must only appear on attributes with a type of <code
88458841
data-x="idl-long">long</code>.</p>
88468842

88478843
<p>IDL attributes with the <code data-x="xattr-ReflectNonNegative">[ReflectNonNegative]</code>
88488844
<span>extended attribute</span> must <span>reflect</span>, <span>limited to only non-negative
8849-
numbers</span>, the content attribute of the name provided by <code
8850-
data-x="xattr-ReflectNonNegative">[ReflectNonNegative]</code> or the IDL attribute name if none is
8851-
provided.</p>
8845+
numbers</span>, <code data-x="xattr-ReflectNonNegative">[ReflectNonNegative]</code>'s
8846+
<span>reflected content attribute name</span>.</p>
88528847

88538848
<p>The <code data-x="xattr-ReflectPositive">[ReflectPositive]</code> and <code
8854-
data-x="xattr-ReflectPositiveWithFallback">[ReflectPositiveWithFallback]</code> <span>extended
8855-
attribute</span>s must only appear on interface member attributes with a type of <code
8856-
data-x="idl-double">double</code> or <code data-x="idl-unsigned-long">unsigned long</code>.</p>
8849+
data-x="xattr-ReflectPositiveWithFallback">[ReflectPositiveWithFallback]</code> <span
8850+
data-x="extended attribute">extended attributes</span> must only appear on attributes with a type
8851+
of <code data-x="idl-double">double</code> or <code data-x="idl-unsigned-long">unsigned
8852+
long</code>.</p>
88578853

88588854
<p>IDL attributes with the <code data-x="xattr-ReflectPositive">[ReflectPositive]</code>
88598855
<span>extended attribute</span> must <span>reflect</span>, <span>limited to only positive
8860-
numbers</span>, the content attribute of the name provided by <code
8861-
data-x="xattr-ReflectPositive">[ReflectPositive]</code> or the IDL attribute name if none is
8862-
provided.</p>
8856+
numbers</span>, <code data-x="xattr-ReflectPositive">[ReflectPositive]</code>'s <span>reflected
8857+
content attribute name</span>.</p>
88638858

88648859
<p>IDL attributes with the <code
88658860
data-x="xattr-ReflectPositiveWithFallback">[ReflectPositiveWithFallback]</code> <span>extended
88668861
attribute</span> must <span>reflect</span>, <span>limited to only positive numbers with
8867-
fallback</span>, the content attribute of the name provided by <code
8868-
data-x="xattr-ReflectPositiveWithFallback">[ReflectPositiveWithFallback]</code> or the IDL
8869-
attribute name if none is provided.</p>
8862+
fallback</span>, <code
8863+
data-x="xattr-ReflectPositiveWithFallback">[ReflectPositiveWithFallback]</code>'s <span>reflected
8864+
content attribute name</span></p>
8865+
8866+
<hr>
8867+
8868+
<p>To supplement the above <span data-x="extended attribute">extended attributes</span> we also
8869+
introduce <dfn extended-attribute data-lt="ReflectRange"
8870+
data-x="xattr-ReflectRange"><code>[ReflectRange]</code></dfn>, and <dfn extended-attribute
8871+
data-lt="ReflectDefault" data-x="xattr-ReflectDefault"><code>[ReflectDefault]</code></dfn>. These
8872+
augment how <span data-x="reflect">reflection</span> works and also must only appear on interface
8873+
member attributes.</p>
88708874

88718875
<p>The <code data-x="xattr-ReflectRange">[ReflectRange]</code> <span>extended attribute</span>
8872-
must take an integer list limited to two values. It must not appear on anything other than an
8873-
interface member attribute with a type of <code data-x="idl-unsigned-long">unsigned long</code>.
8874-
Additionally, it must also only appear alongside <code
8875-
data-x="xattr-Reflect">[Reflect]</code>.</p>
8876+
must take an integer list limited to two values. It must only be used on attributes with a type of
8877+
<code data-x="idl-unsigned-long">unsigned long</code>. Additionally, it must also only appear
8878+
alongside <code data-x="xattr-Reflect">[Reflect]</code>.</p>
88768879

88778880
<p>IDL attributes with the <code data-x="xattr-ReflectRange">[ReflectRange]</code> <span>extended
88788881
attribute</span> are <span>clamped to the range</span> [<var>clampedMin</var>,
@@ -8881,12 +8884,12 @@ a.setAttribute('href', 'https://example.com/'); // change the content attribute
88818884
data-x="xattr-ReflectRange">[ReflectRange]</code>.</p>
88828885

88838886
<p>The <code data-x="xattr-ReflectDefault">[ReflectDefault]</code> <span>extended attribute</span>
8884-
must not appear on anything other than an interface member attribute with a type of <code
8885-
data-x="idl-double">double</code>, <code data-x="idl-long">long</code>, or <code
8886-
data-x="idl-unsigned-long">unsigned long</code>. When used on an attribute of type <code
8887-
data-x="idl-double">double</code>, it must take a decimal, otherwise it must take an integer.
8888-
Additionally, it must also only appear alongside <code data-x="xattr-Reflect">[Reflect]</code>,
8889-
<code data-x="xattr-ReflectNonNegative">[ReflectNonNegative]</code>, <code
8887+
must only be used on attributes with a type of <code data-x="idl-double">double</code>, <code
8888+
data-x="idl-long">long</code>, or <code data-x="idl-unsigned-long">unsigned long</code>. When used
8889+
on an attribute of type <code data-x="idl-double">double</code>, it must take a decimal, otherwise
8890+
it must take an integer. Additionally, it must also only appear alongside <code
8891+
data-x="xattr-Reflect">[Reflect]</code>, <code
8892+
data-x="xattr-ReflectNonNegative">[ReflectNonNegative]</code>, <code
88908893
data-x="xattr-ReflectPositive">[ReflectPositive]</code>, or <code
88918894
data-x="xattr-ReflectPositiveWithFallback">[ReflectPositiveWithFallback]</code>.</p>
88928895

0 commit comments

Comments
 (0)