-
Notifications
You must be signed in to change notification settings - Fork 2.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Specify polymorphic reflection for elements. #3925
Changes from all commits
656b4a0
ed16f20
9b05471
dfe14fa
bac8211
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7309,8 +7309,80 @@ a.setAttribute('href', 'https://example.com/'); // change the content attribute | |
return a <code>DOMTokenList</code> object whose associated element is the element in question and | ||
whose associated attribute's local name is the name of the attribute in question.</p> | ||
|
||
</div> | ||
<p>If a reflecting IDL attribute <var>attr</var> has the type | ||
<code data-x="">(<var>Interface</var> or DOMString)</code>, | ||
where <var>Interface</var> is <code>HTMLElement</code> | ||
or an interface that inherits from <code>HTMLElement</code>, | ||
then it has a relationship with the reflected content attribute as follows: | ||
|
||
<ul> | ||
<li><p>The element <var>hostElement</var> is said to have a(n) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 1-space indents throughout, not 2-space |
||
<var>attr</var>-associated element, which may be implicit or explicit:</p> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The cross-referencing for this is tricky. I think you'll want to wrap this in <span data-x="attr-associated element"><code data-x="">htmlFor</code>-associated element</span> That should work... |
||
<ul> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ol, not ul |
||
<li><p>If <var>attr</var> is set to a <code data-x="idl-domstring">DOMString</code>, | ||
<var>hostElement</var> is said to have an implicit <var>attr</var>-associated element, | ||
and its <var>attr</var>-associated element is | ||
the first element in the same tree as <var>hostElement</var> | ||
whose <span data-x="concept-ID">ID</span> is equal to the value of <var>attr</var>, | ||
or null if no such element exists.</p></li> | ||
|
||
<li><p>If <var>attr</var> is set to an instance <var>element</var> of <var>Interface</var>, | ||
<var>hostElement</var> is said to have an explicit <var>attr</var>-associated element, | ||
and its <var>attr</var>-associated element is <var>element</var>.</p></li> | ||
</ul> | ||
</li> | ||
|
||
<li><p>On setting the IDL attribute to a new value, <var>newValue</var>:</p> | ||
<ul> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ol, not ul. |
||
<li><p>If <var>newValue</var> is a <code data-x="idl-domstring">DOMString</code>, | ||
set the content attribute to <var>newValue</var>.</p></li> | ||
|
||
<li><p>If <var>newValue</var> is an instance of <var>Interface</var>, | ||
run the following algorithm:</p> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. s/run the following algorithm/then |
||
<ol> | ||
<li><p>Set the <var>attr</var>-associated element of <var>hostElement</var> | ||
to null.</p></li> | ||
|
||
<li><p>Let <var>newElement</var> be <var>newValue</var>.</p></li> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think this aliasing doesn't buy us anything; we can just use newValue, right? |
||
|
||
<li><p>If <var>newElement</var> is not in the same tree as <var>hostElement</var>, | ||
nor the same tree as <var>hostElement</var>'s shadow-including root, | ||
then remove the content attribute and return. | ||
</p></li> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Cross-reference tree and shadow-including root. No newline/spaces before |
||
|
||
<li><p>Otherwise, set the <var>attr</var>-associated element of <var>hostElement</var> | ||
to <var>newElement</var>.</p></li> | ||
|
||
<li><p>Let <var>id</var> be the empty string.</p></li> | ||
|
||
<li><p>If the <var>newElement</var> has an <code data-x="attr-id">id</code> attribute, | ||
and is in the same <span>tree</span> as <var>hostElement</var>, | ||
and <var>newElement</var> is the first element in that <span>tree</span> | ||
whose <span data-x="concept-ID">ID</span> is the value | ||
of that <code data-x="attr-id">id</code> attribute, | ||
then let <var>id</var> be the value of that <code data-x="attr-id">id</code> attribute. | ||
</p></li> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No newline/spaces before |
||
|
||
<li><p>Set the content attribute to <var>id</var>.</p></li> | ||
</ol> | ||
</li> | ||
</ul> | ||
</li> | ||
|
||
<li><p>On getting the IDL attribute:</p> | ||
<ul> | ||
<li><p>If <var>hostElement</var> has a(n) <var>attr</var>-associated element, | ||
<var>element</var>, return <var>element</var>.</p></li> | ||
|
||
<li><p>Otherwise, if the content attribute exists, | ||
return the value of the content attribute.</p></li> | ||
|
||
<li><p>Otherwise, return null.</p></li> | ||
</ul> | ||
</li> | ||
</ul> | ||
|
||
</div> | ||
|
||
<h4>Collections</h4> | ||
|
||
|
@@ -43222,7 +43294,7 @@ interface <dfn>HTMLFormElement</dfn> : <span>HTMLElement</span> { | |
<span>HTMLConstructor</span>] | ||
interface <dfn>HTMLLabelElement</dfn> : <span>HTMLElement</span> { | ||
readonly attribute <span>HTMLFormElement</span>? <span data-x="dom-label-form">form</span>; | ||
[<span>CEReactions</span>] attribute DOMString <span data-x="dom-label-htmlFor">htmlFor</span>; | ||
[<span>CEReactions</span>] attribute (HTMLElement or DOMString)? <span data-x="dom-label-htmlFor">htmlFor</span>; | ||
readonly attribute <span>HTMLElement</span>? <span data-x="dom-label-control">control</span>; | ||
};</code></pre> | ||
</dd> | ||
|
@@ -43231,33 +43303,32 @@ interface <dfn>HTMLLabelElement</dfn> : <span>HTMLElement</span> { | |
|
||
<p>The <code>label</code> element <span>represents</span> a caption in a user interface. The | ||
caption can be associated with a specific form control<span w-nodev>, known as the | ||
<code>label</code> element's <dfn>labeled control</dfn></span>, either using the <code | ||
data-x="attr-label-for">for</code> attribute, or by putting the form control inside the | ||
<code>label</code> element itself.</p> | ||
<code>label</code> element's <dfn>labeled control</dfn></span>, | ||
either using the <code data-x="attr-label-for">for</code> attribute, | ||
or by putting the form control inside the <code>label</code> element itself.</p> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This just changed the wrapping, right? Better to not do this if possible. |
||
|
||
<div w-nodev> | ||
|
||
<p>Except where otherwise specified by the following rules, a <code>label</code> element has no | ||
<span>labeled control</span>.</p> | ||
|
||
</div> | ||
|
||
<p>The <dfn><code data-x="attr-label-for">for</code></dfn> attribute may be specified to indicate a | ||
form control with which the caption is to be associated. If the attribute is specified, the | ||
attribute's value must be the <span data-x="concept-id">ID</span> of a <span | ||
data-x="category-label">labelable element</span> in the same <span>tree</span> as the | ||
<code>label</code> element. <span w-nodev>If the attribute is specified and there is an | ||
element in the <span>tree</span> whose <span data-x="concept-id">ID</span> is equal to the value | ||
of the <code data-x="attr-label-for">for</code> attribute, and the first such element in | ||
<span>tree order</span> is a <span data-x="category-label">labelable element</span>, then that | ||
element is the <code>label</code> element's <span>labeled control</span>.</span></p> | ||
<p>The <dfn><code data-x="attr-label-for">for</code></dfn> attribute | ||
may be specified to indicate a form control with which the caption is to be associated. | ||
It is reflected by the <code data-x="dom-label-htmlFor">htmlFor</code> attribute. | ||
If the attribute is specified such that the | ||
<code data-x="dom-label-htmlFor">htmlFor</code>-associated element is not null, | ||
then the <code>label</code> element's <span>labeled control</span> is the <code>label</code>'s | ||
<code data-x="dom-label-htmlFor">htmlFor</code>-associated element. | ||
</p> | ||
|
||
<div w-nodev> | ||
|
||
<p>If the <code data-x="attr-label-for">for</code> attribute is not specified, but the | ||
<code>label</code> element has a <span data-x="category-label">labelable element</span> descendant, | ||
then the first such descendant in <span>tree order</span> is the <code>label</code> element's | ||
<span>labeled control</span>.</p> | ||
<p>If the <code>label</code> does not have an | ||
<code data-x="dom-label-htmlFor">htmlFor</code>-associated element, but | ||
the <code>label</code> element has a <span data-x="category-label">labelable element</span> | ||
descendant, then the first such descendant in <span>tree order</span> is the <code>label</code> | ||
element's <span>labeled control</span>.</p> | ||
|
||
<p>The <code>label</code> element's exact default presentation and behavior, in particular what | ||
its <span>activation behavior</span> might be, if anything, should match the platform's label | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just "an" is fine