-
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
Add logic for reflecting IDREF attributes #7934
Conversation
This defines IDL reflection for single and FrozenArray attributes. This work was done mostly by @alice. This is just a rebase of the following PR: whatwg#3917
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.
This overall looks great. I'm excited to see implementations have happened since I last was reviewing this. I found a few editorial nits but I'd be happy to add this to the spec.
I am not really familiar with the shadow tree details so if you, or another reviewer, wants to confirm that the tests you linked match the spec draft here, that would be helpful.
I don't see tests for the caching invariant, e.g. testing that assert_equals(input1.ariaLabelledByElements, input1.ariaLabelledByElements)
(in the array case, not just the trivial null
case). Could you be sure those are added?
I will note that since this was originally written, ObservableArray<T>
has become a thing, and using it instead of FrozenArray<T>
would probably be more friendly to web developers. And I suspect that if we merge this now people won't necessarily put in the work to upgrade it over time, which is sad. But I don't want to stand in the way of people unflagging a feature with two implementations... Let us know if you have any thoughts on that.
06c62bf
to
e7d4216
Compare
e7d4216
to
88eedce
Compare
Thanks for the quick review. I've applied the suggested changes.
I'm not a Shadow DOM expert, but the tests seem to cover what this PR mentions. Maybe others could confirm that.
I'm adding them in web-platform-tests/wpt#34095.
Looks like WebKit doesn't have |
On top of that I've added more tests to check this in different situations at web-platform-tests/wpt#34194 And I've also fixed the WebKit implementation so now all the tests pass on WebKit, and the caching invariant works as expected with In addition, Chromium has a TODO to fix this in the code (see this comment). Giving the above information, is this PR blocked on something else? |
I think we need to point out that an element's explicitly set attr-elements are weak references, no? The idea being that if the elements they point to can be collected, this shouldn't hold them alive as the corresponding attr-associated element will already have started returning null. That also makes it clearer you really cannot depend on explicitly set attr-element. Perhaps we should stress that even more though by prefixing it with "internal" or some such? I'm concerned as in WICG/aom#192 (comment) there's already a suggestion other things could build on top of these internal details, which I don't think is workable. cc @smaug---- |
Good idea, also both implementations use weak references. I've uploaded a new commit adding some text about that.
I've already mentioned there that the idea should be discarded, it was just an idea on the last AOM meeting and people were not very aware of the this spec text. I have the feeling that the spec text is pretty clear with the 2 notes:
TBH, I'm not sure if naming them internal would have encouraged not to think on the possibility that was discussed in WICG/aom#192 (comment). Anyway if you think that it's going to help I guess we can just add "internal" to both the explicitly set and the cached one. WDYT? |
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.
Thanks @mrego! I think you're correct that the notes should suffice. I have a number of tiny nits, but overall this looks great.
@domenic I was hoping you could do a final pass and land this. |
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.
Only one substantive comment, which is that I believe we forgot the null handling for the T?
case. Everything else is minor style updates (which I would have fixed myself before landing if it weren't for the more substantive issue.)
<ol> | ||
<li><p>If <var>value</var> is empty and <var>elements</var> is non-empty, then <span | ||
data-x="list append">append</span> a weak reference to <var>element</var> to | ||
<var>elements</var> and <span>continue</span>.</p></li> |
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.
I think this would be slightly nicer as two nested steps. On first glance I missed the "continue" which made the next step quite confusing.
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.
I've tried to do this, but not totally sure if that was what you were looking for, please check.
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.
LGTM! Will merge tomorrow.
Now that HTML spec defines reflection for Element and FrozenArray<Element> attributes (see whatwg/html#7934), we can add back these attributes to ARIA IDL. This is simply a revert of w3c#1260.
Now that HTML spec defines reflection for Element and FrozenArray<Element> attributes (see whatwg/html#7934), we can add back these attributes to ARIA IDL. This is simply a revert of #1260.
Now that HTML spec defines reflection for Element and FrozenArray<Element> attributes (see whatwg/html#7934), we can add back these attributes to ARIA IDL. This is simply a revert of #1260.
Now that HTML spec defines reflection for Element and FrozenArray<Element> attributes (see whatwg/html#7934), we can add back these attributes to ARIA IDL. This is simply a revert of #1260.
This defines IDL reflection for single and FrozenArray attributes.
This work was done mostly by @alice.
This is just a rebase of the following PR: #3917
AOMAriaRelationshipProperties
flag.AriaReflectionForElementReferencesEnabled
flag./canvas.html ( diff )
/common-dom-interfaces.html ( diff )
/infrastructure.html ( diff )