Conversation
|
@annevk, @domenic, this isn't quite ready to land yet as there are still a few open questions to sort out (at least WICG/webcomponents#1087 and WICG/webcomponents#1093), plus missing implementor positions. But I don't expect most of the mechanics in this PR to change, so I think it would be great to get feedback on whether the approach we've used here is agreeable. See also whatwg/dom#1353 Thanks! |
|
There's also a WIP PR against ARIA to account for these changes: w3c/aria#2474 There are some open questions being discussed there on exactly how to refer to the HTML concepts, since ARIA needs to be language-independent, but it will certainly refer to these spec concepts in some form. |
lukewarlow
left a comment
There was a problem hiding this comment.
This should be updated to make use of the new [Reflect] syntax.
Thanks @lukewarlow! Fixed now (it wouldn't let me merge the suggestions directly due to merge conflicts). |
|
I'm not sure how GitHub actually lets you dismiss change suggestions but consider this me dropping my change suggestions as they've been resolved :) |
keithamus
left a comment
There was a problem hiding this comment.
I've done an initial review pass, got about half way, but I thought I'd provide my review commentary so far because I think if I continue I may end up repeating themes.
Some meta commentary:
- I think another formatting pass needs to be done.
- I am a little worried about the retargeting steps, I wonder if this can be simplified to avoid retargeting and to resolve a reference target where necessary.
|
|
||
| <li><p>If no such element exists, return null.</p></li> | ||
|
|
||
| <li><p>Return the result of <span data-x="resolve-the-reference-target">resolving the reference |
There was a problem hiding this comment.
Can you help me understand how this set of steps avoids exposing elements in the shadow root to code calling the IDL bindings?
It seems as though there's nothing in the spec that says "when script calls this, it should not resolve the reference target".
The way I would interpret this is that IDL should return the resolved reference target, which is obviously wrong as it would expose ShadowDOM elements to script.
I'm surprised this has is written this way, I would have imagined we would not change reflection rules, and instead wherever we look at an element reflecting attribute, we would have an additional step to resolve the reference target there.
There was a problem hiding this comment.
As we discussed elsewhere, the reasoning here is:
- This logic is just about how to actually make use of the reference target. (Probably this comment was actually meant to go somewhere else.)
- We always resolve the reference target, even if we're just going to retarget the resulting value, so that we can handle invalid references by returning
null.
We did explore the possibility in our discussion just now of not handling invalid references that way, and instead just not resolving the reference target for IDL attribute getters (in fact, this is what the original design did before that issue was filed), but my argument for keeping this behaviour was:
- This is consistent with
label.controlfor<label>wrapped: if no descendant element is labelable, either by being labelable itself or by having a labelable resolved reference target,label.controlwill return null. If there is a descendant element which has a labelable resolved reference target, that element will be returned. - This is also consistent with IDL setter/getters without reference target: if you attempt to set an invalid (e.g. in shadow DOM) element as an IDL attribute, for example
lightDomElement.ariaActiveDescendantElement = shadowDomElement, the getter will return null (lightDomElement.ariaActiveDescendantElement === null). - I'm not convinced we actually gain that much either in code maintainability or in runtime performance in practice from skipping the resolve the reference target step for IDL attribute getters, since I think calls of these algorithms will be heavily dominated by "internal" callers which must do the resolution.
source
Outdated
| <span>shadow root</span>'s <span>reference target</span> is null, return <var>element</var>.</p> | ||
| </li> | ||
|
|
||
| <li><p>Let <var>referenceTarget</var> be the value of <var>element</var>'s <span>shadow |
There was a problem hiding this comment.
I was a little confused here about what referenceTarget represents. A non-binding suggestion: rename this to perhaps referenceTargetId or just targetId or similar?
| <li><p>Let <var>candidate</var> be the first element in <var>element</var>'s <span>shadow | ||
| root</span> whose <span data-x="concept-id">ID</span> matches <var>referenceTarget</var>.</p> | ||
| </li> | ||
|
|
||
| <li><p>If no such element exists, return null.</p></li> |
There was a problem hiding this comment.
These steps being disjoint were confusing to me, as step 4 read in isolation makes no reference to variables or some such. I think they'd be better joined:
| <li><p>Let <var>candidate</var> be the first element in <var>element</var>'s <span>shadow | |
| root</span> whose <span data-x="concept-id">ID</span> matches <var>referenceTarget</var>.</p> | |
| </li> | |
| <li><p>If no such element exists, return null.</p></li> | |
| <li><p>Let <var>candidate</var> be the first element in <var>element</var>'s <span>shadow | |
| root</span> whose <span data-x="concept-id">ID</span> matches <var>referenceTarget</var>. If no | |
| such element exists, then return null.</p></li> |
Or alternatively:
| <li><p>Let <var>candidate</var> be the first element in <var>element</var>'s <span>shadow | |
| root</span> whose <span data-x="concept-id">ID</span> matches <var>referenceTarget</var>.</p> | |
| </li> | |
| <li><p>If no such element exists, return null.</p></li> | |
| <li><p>Let <var>candidate</var> be the first element in <var>element</var>'s <span>shadow | |
| root</span> whose <span data-x="concept-id">ID</span> matches <var>referenceTarget</var>. If no | |
| such element exists, then instead let <var>element</var> be null.</p></li> | |
| <li><p>If <var>element</var> is null, then return null</p></li> | |
There was a problem hiding this comment.
It seems this comment is still applicable. Though note that the second suggestion is wrong as it mixes candidate and element.
source
Outdated
| <li><p>Return the result of <span data-x="resolve-the-reference-target">resolving the reference | ||
| target</span> on <var>candidate</var>. | ||
| </p></li> |
There was a problem hiding this comment.
Formatting:
| <li><p>Return the result of <span data-x="resolve-the-reference-target">resolving the reference | |
| target</span> on <var>candidate</var>. | |
| </p></li> | |
| <li><p>Return the result of <span data-x="resolve-the-reference-target">resolving the reference | |
| target</span> on <var>candidate</var>.</p></li> |
source
Outdated
| <p><dfn data-x="element reference attribute" data-lt="element reference" export> | ||
| Element reference attributes</dfn> refer to one or more Elements in the document. When specified | ||
| as content attributes, <span | ||
| data-x="element reference attribute">element reference attributes</span> refer to other Elements | ||
| via their <span data-x="concept-ID">ID</span>s. |
There was a problem hiding this comment.
Formatting is not right here, I think, but also it's missing a </p>:
| <p><dfn data-x="element reference attribute" data-lt="element reference" export> | |
| Element reference attributes</dfn> refer to one or more Elements in the document. When specified | |
| as content attributes, <span | |
| data-x="element reference attribute">element reference attributes</span> refer to other Elements | |
| via their <span data-x="concept-ID">ID</span>s. | |
| <p><dfn data-x="element reference attribute" data-lt="element reference" export>Element reference | |
| attributes</dfn> refer to one or more Elements in the document. When specified as content | |
| attributes, <span data-x="element reference attribute">element reference attributes</span> refer | |
| to other Elements via their <span data-x="concept-ID">ID</span>s.</p> |
| </ol> | ||
| </li> | ||
| </ol> | ||
|
|
There was a problem hiding this comment.
Double line break:
| <p class="note">An element will only have | ||
| <span data-x="explicitly set attr-elements">explicitly-set <var>attr</var>-elements</span> if it | ||
| has an IDL attribute with type <code | ||
| data-x="">FrozenArray<<var>T</var>>?</code>, where <var>T</var> is either | ||
| <code>Element</code> or an interface that inherits from <code>Element</code>, which | ||
| <span data-x="reflect">reflects</span> <var>attr</var>.</p> |
There was a problem hiding this comment.
Formatting seems wonky here, maybe this is better:
| <p class="note">An element will only have | |
| <span data-x="explicitly set attr-elements">explicitly-set <var>attr</var>-elements</span> if it | |
| has an IDL attribute with type <code | |
| data-x="">FrozenArray<<var>T</var>>?</code>, where <var>T</var> is either | |
| <code>Element</code> or an interface that inherits from <code>Element</code>, which | |
| <span data-x="reflect">reflects</span> <var>attr</var>.</p> | |
| <p class="note">An element will only have | |
| <span data-x="explicitly set attr-elements">explicitly-set <var>attr</var>-elements</span> if it | |
| has an IDL attribute with type <code data-x="">FrozenArray<<var>T</var>>?</code>, where | |
| <var>T</var> is either <code>Element</code> or an interface that inherits from | |
| <code>Element</code>, which <span data-x="reflect">reflects</span> <var>attr</var>.</p> |
source
Outdated
| <li> | ||
| <p><span data-x="list iterate">For each</span> <var>candidate</var> in <var>candidates</var>: | ||
| </p> | ||
|
|
||
| <ol> | ||
| <li><p>Let <var>resolvedCandidate</var> be the result of | ||
| <span data-x="resolve-the-reference-target">resolving the reference target</span> on | ||
| <var>candidate</var>.</p></li> | ||
|
|
||
| <li><p>If <var>resolvedCandidate</var> is not null, append <var>resolvedCandidate</var> to | ||
| <var>resolvedCandidates</var>.</p></li> | ||
| </ol> | ||
| </li> | ||
|
|
||
| <li><p>Return <var>resolvedCandidates</var>.</p></li> | ||
| </ol> |
There was a problem hiding this comment.
Why do we make a list of candidates to then re-iterate the list and resolve them? Would it not be easier to resolve each candidate during the for each steps so that candidates is a list of resolvedCandidates?
There was a problem hiding this comment.
I guess because there are two ways to collate candidates, and I didn't want to have each path also do the resolution.
source
Outdated
| <li><p>Let <var>candidate</var> be the result of running <span>this</span>'s | ||
| <span data-x="get the attr-associated element">get the <var>attr</var>-associated | ||
| element</span>.</p> |
There was a problem hiding this comment.
Oh I see. IDL reflections take the attr-resolved reference target and then retarget against element. This seems a little like extra work for no payoff. Are there concrete reasons to do this, rather than having attr-resolved elements return the element, and then in each spec resolve the reference target?
I'm also not sure retargeting against element is always going to consistently give the same result as the old way of handling things. This feels awkward to me.
There was a problem hiding this comment.
Are there concrete reasons to do this, rather than having attr-resolved elements return the element, and then in each spec resolve the reference target?
I think main reason to have "get the attr-associated element(s)" do the retargeting is that we resolved that reference target should apply to all IDREF-type attributes: WICG/webcomponents#1091
So, when defining an attribute, the spec need only refer to "get the attr-associated element(s)" and it'll automatically be opted in to that behaviour, as well as automatically working with "explicitly-set attr-elements" iff the appropriate IDL attribute is defined.
If some attribute really wants to opt out, the spec can instead use the "first element whose ID matches" language (although there's not really a way to opt out and have the IDL attribute work).
I'm also not sure retargeting against element is always going to consistently give the same result as the old way of handling things. This feels awkward to me.
I think retargeting should work, regardless of whether this is in the same tree as candidate or in (relative) shadow DOM.
We did discuss a potential optimisation here: "get the attr-associated element" could take an optional argument, something like "encapsulation preserving" or "for bindings", which would cause the algorithm to return the non-resolved element iff resolving the element didn't return null. I'd be happy to draft a change to see what that would look like.
There was a problem hiding this comment.
Ok, the latest change explores moving the "retargeting" step into the "get the attr-associated element(s)" algorithms (and not actually invoking retargeting, but instead just returning the shadow host we already found before resolving the reference target).
| readonly attribute <span>HTMLFormElement</span>? <span data-x="dom-label-form">form</span>; | ||
| readonly attribute <span>HTMLElement</span>? <span data-x="dom-label-form">form</span>; |
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
There was a problem hiding this comment.
Would it be observable? You'd still end up with a form element returned in all existing code right?
There was a problem hiding this comment.
Current code expects a form element or null. This change would mean it could get some other thing, which may be surprising.
An example of a potential surprise: if (foo.form) new FormData(foo.form) would now throw an error.
There was a problem hiding this comment.
Yeah but you'd only get that if you start using this new referencetarget? So it's not really a compat issue as I understand it?
There was a problem hiding this comment.
I guess "web compatible" is the wrong term here. Old sites wouldn't break, but the change here might cause a surprise for actively maintained websites.
I guess I'll mark as resolved.
source
Outdated
| <ol> | ||
| <li> | ||
| <p><span data-x="list iterate">For each</span> <var>attrElement</var> in | ||
| <var>reflectedTarget</var>'s <span>explicitly set <var>attr</var>-elements</span>:</p> |
There was a problem hiding this comment.
| <var>reflectedTarget</var>'s <span>explicitly set <var>attr</var>-elements</span>:</p> | |
| <var>element</var>'s <span>explicitly set <var>attr</var>-elements</span>:</p> |
| <span>tree</span>.</p> | ||
| a valid <span>single element reference</span> attribute | ||
| <span data-x="single-element-reference-refers-to">referring to</span> a <code>form</code> | ||
| element.</p> |
There was a problem hiding this comment.
This isn't perhaps super clear. I think this means that the final element from single element reference should be a form element
There was a problem hiding this comment.
That's right. I'm not really sure of a clearer way to put it.
There was a problem hiding this comment.
I wonder if this all works well for the Developer Edition of the standard as now we're phrasing conformance requirements in terms of algorithms aimed at implementers?
source
Outdated
| <li><p>Let <var>candidates</var> be an empty <span>list</span>.</p></li> | ||
|
|
||
| <li> | ||
| <p>If <var>element</var>'s has an <span>explicitly set <var>attr</var>-elements</span> which |
There was a problem hiding this comment.
This isn't grammatically correct. Based on the which I'm guessing the has is correct so drop the 's
| <p>If <var>element</var>'s has an <span>explicitly set <var>attr</var>-elements</span> which | |
| <p>If <var>element</var> has an <span>explicitly set <var>attr</var>-elements</span> which |
source
Outdated
| 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> | ||
| attribute is specified, the attribute's value must be the a valid <span>single element | ||
| reference</span> attribute.</p> |
There was a problem hiding this comment.
But the final result of single element reference doesn't need to be labelable element?
There was a problem hiding this comment.
Ah oops, I had intended to add that restriction and it must have dropped off my radar somewhere. Should be fixed now.
| <var>descendant</var>.</p></li> | ||
|
|
||
| <li><p>If <var>candidate</var> is a <span data-x="category-label">labelable element</span>, | ||
| return <var>candidate</var>.</p></li> |
There was a problem hiding this comment.
This handling of descendants feels a bit surprising, but I don't have strong opinions, and the behavior is probably fine.
| data-x="attr-popover">popover</code> attribute in the same <span>tree</span> as the <span | ||
| data-x="concept-button">button</span> with the <code | ||
| be a valid <span>single element reference</span> attribute | ||
| <span data-x="single-element-reference-refers-to">referring to</span> an element with the <code |
There was a problem hiding this comment.
Is this correct? The old text requires an element with popover attribute.
There was a problem hiding this comment.
Huh, yeah, something went weird there. Fixed.
alice
left a comment
There was a problem hiding this comment.
I had to apply all the code suggestions manually, because I foolishly pushed my changes before I'd applied them.
source
Outdated
| </ol> | ||
| </li> | ||
|
|
||
| <li>If candidate is null, return null.</li> |
There was a problem hiding this comment.
| <li>If candidate is null, return null.</li> | |
| <li><p>If candidate is null, return null.</p></li> |
source
Outdated
| </ul> | ||
|
|
||
| <p>If no such element exists, then return null.</p> | ||
| <li><p>Let <var>candidate</var> be the result of running <span>this</span>'s |
There was a problem hiding this comment.
@dandclark @keithamus I filed WICG/webcomponents#1114 after having second thoughts about this logic.
source
Outdated
| <p><dfn data-x="element reference attribute" data-lt="element reference" export>Element reference | ||
| attributes</dfn> refer to one or more Elements in the document. When specified as content | ||
| attributes, <span data-x="element reference attribute">element reference attributes</span> refer | ||
| to other Elements via their <span data-x="concept-ID">ID</span>s.</p> |
There was a problem hiding this comment.
Elements should be lowercase (applies multiple times!), unless you specifically want to talk about Element nodes/objects, but I don't think that's necessary here.
There was a problem hiding this comment.
I fixed a couple here; I think that's all of them?
source
Outdated
|
|
||
| <ol> | ||
| <li><p>If <var>element</var> does not have a <span>shadow root</span>, or <var>element</var>'s | ||
| <span>shadow root</span>'s <span>reference target</span> is null, return <var>element</var>.</p> |
| <li><p>Let <var>candidate</var> be the first element in <var>element</var>'s <span>shadow | ||
| root</span> whose <span data-x="concept-id">ID</span> matches <var>referenceTarget</var>.</p> | ||
| </li> | ||
|
|
||
| <li><p>If no such element exists, return null.</p></li> |
There was a problem hiding this comment.
It seems this comment is still applicable. Though note that the second suggestion is wrong as it mixes candidate and element.
source
Outdated
| </p></li> | ||
| </ol> | ||
|
|
||
| <h5>Single element references</h5> |
There was a problem hiding this comment.
It should probably be "Single-element references" throughout (hyphen).
source
Outdated
| target</dfn> on an element <var>element</var> are:</p> | ||
|
|
||
| <ol> | ||
| <li><p>If <var>element</var> does not have a <span>shadow root</span>, or <var>element</var>'s |
There was a problem hiding this comment.
I don't understand what this means. Did you mean to say "If element is not a shadow host"?
There was a problem hiding this comment.
Most likely, yes. Changed it to that.
| <code>Element</code>, then with <var>attr</var> being the <span>reflected content attribute | ||
| name</span>:</p> | ||
| <p>If a <span>reflected IDL attribute</span> has the type <code>Element</code>, then with | ||
| <var>attr</var> being the <span>reflected content attribute name</span>:</p> |
There was a problem hiding this comment.
Why did you make this change? This seems wrong. And if this is somehow correct, let's make this change in a separate PR as it's unrelated.
There was a problem hiding this comment.
I think this was because we realised that we couldn't really have the reflected elements be a specific type, since reference target means the attr-associated element might be in a shadow root and the shadow-host would be the reflected element.
There was a problem hiding this comment.
To restate this (for my own edification, so if you could please confirm):
Prior to this change an IDL reflected attribute could be T because it could sub-type an element type, e.g. HTMLLabelElement would be a viable reflection. However as now we're using referencetarget, we need to retarget (or otherwise remap) that element to the host, therefore nothing can ever reflect T because it we can never guarantee it's the subtype as there's always a possibility that it's a host element.
I wonder if other specs (e.g. DOM? CSS?) implicitly rely on this reflection mechanism?
There was a problem hiding this comment.
@keithamus That's exactly right.
As far as I know, nothing actually used this subtyping mechanism.
- the ARIAMixin attributes which use this type of reflection are all
ElementorFrozenArray<Element> popoverTargetElementis anElement?commandForElementis anElement?
I think we had some idea that it might be useful for something like the form or headers attributes, which actually are limited to one specific element class, but a very limited and hypothetical benefit - even <label for>, which is limited to labelable elements, can't be limited by element class in this way.
There was a problem hiding this comment.
To illustrate this with a code example (because it does confuse me too):
<fancy-form id="form">
<template shadowRootMode="open" shadowRootReferenceTarget="real-form">
<form id="real-form"></form>
</template>
</fancy-form>
<input id="input">// if we reflected `form` as an element attribute:
input.formElement = document.getElementById("form");This would be a working association, even though <fancy-form> doesn't inherit from HTMLFormElement, because the resolved reference target is the enclosed <form>.
| data-x="">FrozenArray<Element>?</code>, then with <var>attr</var> being the <span>reflected | ||
| content attribute name</span>:</p> |
There was a problem hiding this comment.
Again this seems out-of-scope for this PR.
There was a problem hiding this comment.
As above. I'm happy to revert them if you don't agree with the logic, though.
source
Outdated
| to</span> a <span data-x="category-label">labelable element</span>.</p> | ||
|
|
||
| <div w-nodev> | ||
| <p>To determine a <code>label</code> element's <dfn>labeled control</dfn>, run these steps:</p> |
There was a problem hiding this comment.
| <p>To determine a <code>label</code> element's <dfn>labeled control</dfn>, run these steps:</p> | |
| <p>To determine a <code>label</code> element <var>label</var>'s <dfn>labeled control</dfn>:</p> |
(this also requires changes to the algorithm)
| <span>tree</span>.</p> | ||
| a valid <span>single element reference</span> attribute | ||
| <span data-x="single-element-reference-refers-to">referring to</span> a <code>form</code> | ||
| element.</p> |
There was a problem hiding this comment.
I wonder if this all works well for the Developer Edition of the standard as now we're phrasing conformance requirements in terms of algorithms aimed at implementers?
source
Outdated
| "<code data-x=""> shadowrootcustomelementregistry=""</code>".</p></li> | ||
|
|
||
| <li> | ||
| <p>If <var>shadow</var>'s <span>reference target</span> is set, then:</p> |
There was a problem hiding this comment.
| <p>If <var>shadow</var>'s <span>reference target</span> is set, then:</p> | |
| <p>If <var>shadow</var>'s <span>reference target</span> is set:</p> |
Though probably this should be "is non-null"? Generally we don't do optional fields.
There was a problem hiding this comment.
I changed it to "non-null", and removed the "then". I'm a bit confused on when an "if" needs a "then" and when it doesn't, though.
… to shadow creation
…d make some tweaks in the Reflection section
397e6d6 to
5d6f658
Compare
|
My apologies for letting this sit for so long. I've addressed Anne's comments, I think. |
source
Outdated
| <li><dfn data-x="concept-document-type" data-x-href="https://dom.spec.whatwg.org/#concept-document-type">document type</dfn> concept</li> | ||
| <li><dfn data-x="concept-DocumentFragment-host" data-x-href="https://dom.spec.whatwg.org/#concept-documentfragment-host">host</dfn> concept</li> | ||
| <li>The <dfn data-x-href="https://dom.spec.whatwg.org/#concept-shadow-root">shadow root</dfn> concept, and its <dfn data-x-href="https://dom.spec.whatwg.org/#shadowroot-delegates-focus">delegates focus</dfn>, <dfn data-x-href="https://dom.spec.whatwg.org/#shadowroot-available-to-element-internals">available to element internals</dfn>, <dfn data-x-href="https://dom.spec.whatwg.org/#shadowroot-clonable">clonable</dfn>, <dfn data-x="shadow-serializable" data-x-href="https://dom.spec.whatwg.org/#shadowroot-serializable">serializable</dfn>, <dfn data-x="shadow-root-custom-element-registry" data-x-href="https://dom.spec.whatwg.org/#shadowroot-custom-element-registry">custom element registry</dfn>, and <dfn data-x-href="https://dom.spec.whatwg.org/#shadowroot-keep-custom-element-registry-null">keep custom element registry null</dfn>.</li> | ||
| <li>The <dfn data-x-href="https://dom.spec.whatwg.org/#concept-shadow-root">shadow root</dfn> concept, and its <dfn data-x-href="https://dom.spec.whatwg.org/#shadowroot-delegates-focus">delegates focus</dfn>, <dfn data-x-href="https://dom.spec.whatwg.org/#shadowroot-available-to-element-internals">available to element internals</dfn>, <dfn data-x-href="https://dom.spec.whatwg.org/#shadowroot-clonable">clonable</dfn>, <dfn data-x="shadow-serializable" data-x-href="https://dom.spec.whatwg.org/#shadowroot-serializable">serializable</dfn>, <dfn data-x="shadow-root-custom-element-registry" data-x-href="https://dom.spec.whatwg.org/#shadowroot-custom-element-registry">custom element registry</dfn>, <dfn data-x-href="https://dom.spec.whatwg.org/#shadowroot-keep-custom-element-registry-null">keep custom element registry null</dfn>, and <dfn data-x-href="https://dom.spec.whatwg.org/#shadowroot-reference-target">reference target</dfn>.</li> |
There was a problem hiding this comment.
Formatting nit, this should be broken into several lines I think (despite this whole block not following formatting conventions, multiple dfns are broken out, see L3260 below.
source
Outdated
| <var>pending</var>.</p></li> | ||
| <li><p>If <var>root</var> has an <code data-x="attr-itemref">itemref</code> attribute, set | ||
| <var>pending</var> to the <span data-x="get the attr-associated elements"> | ||
| <code data-x="attr-tdth-headers">itemref</code>-associated elements</span>.</p></li> |
There was a problem hiding this comment.
| <code data-x="attr-tdth-headers">itemref</code>-associated elements</span>.</p></li> | |
| <code data-x="attr-itemref">itemref</code>-associated elements</span>.</p></li> |
source
Outdated
| <p>If <var>shadow</var>'s <span>reference target</span> is non-null:</p> | ||
|
|
||
| <ol> | ||
| <li><p>Append "<code data-x=""> shadowrootreferencetarget="</code>".</p></li> |
There was a problem hiding this comment.
The formatting here breaks the reference. Probably something like:
| <li><p>Append "<code data-x=""> shadowrootreferencetarget="</code>".</p></li> | |
| <li><p>Append "<code data-x="shadowrootreferencetarget"> shadowrootreferencetarget="</code>".</p></li> |
…d attr target element(s) and unresolved attr target element(s)
|
Based on discussion in WICG/webcomponents#1114, I wanted to go ahead and fix the reflected attribute values to use a shallower/more naive algorithm. Specifically, we shouldn't need to resolve the reference target at all for reflected attribute getters. @keithamus suggested it might be good to have separate algorithms for getting the elements referred to by an attribute - one for the "shallow" values, and one for the "resolved" values - which calls into the former. I thought that was a great idea, so I've now completely renamed what used to be called "(get the) attr-associated element(s)" to "(get the) resolved attr target element(s)", with "(get the) unresolved attr target element(s)" as the "shallow" algorithm both the former algorithm and the reflected attribute getter calls into. It's annoying to rename attr-associated elements like this, since it's now a relatively long-standing concept from reflected element attributes and a lot of method names in browsers refer to it directly, but I like the new names because:
|
Reference Target allows authors to specify an element inside a shadow root to be the target of any ID references referring to the host element. This would enable IDREF attributes such as for and aria-labelledby to refer to elements inside a component's shadow DOM while maintaining encapsulation of the internal details of the shadow DOM.
See the reference target explainer.
At a high level, the spec change consists of these parts:
get-the-attr-associated-elementalgorithm (and its array-of-elements form) to follow reference target.get-the-attr-associated-element.See also the corresponding whatwg/dom#1353 which adds the definition of reference target used in this PR.
(See WHATWG Working Mode: Changes for more details.)
/common-dom-interfaces.html ( diff )
/common-microsyntaxes.html ( diff )
/dom.html ( diff )
/form-control-infrastructure.html ( diff )
/form-elements.html ( diff )
/forms.html ( diff )
/iframe-embed-object.html ( diff )
/index.html ( diff )
/indices.html ( diff )
/infrastructure.html ( diff )
/input.html ( diff )
/microdata.html ( diff )
/parsing.html ( diff )
/popover.html ( diff )
/scripting.html ( diff )
/tables.html ( diff )