Skip to content
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

Clarify how to use reflect in a specification #8980

Merged
merged 3 commits into from
Mar 8, 2023
Merged

Conversation

annevk
Copy link
Member

@annevk annevk commented Mar 3, 2023

Not sure how happy I am with this exact text, but I wanted to clarify this.


/common-dom-interfaces.html ( diff )
/index.html ( diff )

@annevk annevk added clarification Standard could be clearer topic: reflect For issues with reflected IDL attributes and friends. labels Mar 3, 2023
@annevk annevk requested a review from domenic March 3, 2023 19:56
source Show resolved Hide resolved
source Show resolved Hide resolved
source Show resolved Hide resolved
source Show resolved Hide resolved
source Show resolved Hide resolved
source Show resolved Hide resolved
@@ -8410,6 +8396,34 @@ a.setAttribute('href', 'https://example.com/'); // change the content attribute
type are strongly encouraged to have their identifier end in "<code data-x="">Elements</code>" for
consistency.</p>

<h4>Using reflect in specifications</h4>

<p>The <span>reflect</span> functionality is primarily about improving web developer ergonomics by
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here would be my attempt:

Reflection is primarily about improving web developer ergonomics by giving them typed access to content attributes through reflected IDL attributes. The ultimate source of truth, which the rest of the web platform specification ecosystem interacts with, is still the content attributes themselves. That is, specification authors must not use the reflected IDL attribute's getter or setter steps, but instead must use the content attribute's presence and value. (Or some appropriate abstraction on top of it, such as the current state of an [enumerated attribute].)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, I used a lot from this.

<code>Element</code> or an interface that inherits from <code>Element</code></li>
</ul>

<p>For those, specification authors are to exclusively build upon the <span>reflected
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My attempt:

For content attributes which have such reflected IDL attributes, specification authors must instead use the reflected target's attr-associated element or attr-associated elements respectively. The content attribute values themselves must not be used, as they can contain values that are out of sync with what the web developer has set via the reflected IDL attributes.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ditto.

@annevk annevk requested a review from domenic March 7, 2023 02:16
@annevk annevk merged commit e00748d into main Mar 8, 2023
@annevk annevk deleted the annevk/reflect-spec branch March 8, 2023 14:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
clarification Standard could be clearer topic: reflect For issues with reflected IDL attributes and friends.
Development

Successfully merging this pull request may close these issues.

None yet

2 participants