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

Initial commit for #279. #381

Merged
merged 8 commits into from
Jul 26, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions index.bs
Original file line number Diff line number Diff line change
Expand Up @@ -1001,6 +1001,26 @@ Consider adding such features only in cases when the overall user experience is
A canonical example of this is blocking rendering in order to download and process a stylesheet.
The alternative user experience is a flash of unstyled content, which is undesirable.

<h3 id="html-idl-must-by-synced">Keep attributes in sync</h3>

New content attributes
should have a corresponding IDL attribute with the same name,
and the state between the two should be kept synchronized.
Carving out a synchronized IDL attribute with inconsistent naming
results in confusion, and should be avoided.
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
results in confusion, and should be avoided.
results in confusion, and should be avoided.
<div class=example>
The <{input}> element has <{input/value}> and <{input/checked}> attributes that hold the default state of the element.
There are also {{HTMLInputElement/value}} and {{HTMLInputElement/checked}} that hold the *current* state of the element.
The fact that these are not synchronized, and despite the same name, they actually hold different data, has caused authors a lot of confusion.
</div>


<div class="note">
This does not hold the other way around.
A new IDL attribute does not always warrant a content attribute counterpart.
Copy link
Member

Choose a reason for hiding this comment

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

This needs an example of an IDL attribute that does not correspond to an HTML attribute.

</div>

<div class="example">
A counterpattern to this guidance can be found in
<{input}>'s <{input/value}>, <{option}>'s <{option/selected}>, and <{input}>'s <{input/checked}>
where the HTML attributes were never updated
and the IDL attribute was the single source of truth.
</div>

<h3 id="naming-of-url-attributes">Name URL-containing attributes based on their primary purpose</h3><!-- https://github.com/w3ctag/design-principles/issues/278 -->

If the element enables the user to navigate to the URL contained in the attribute, call the attribute `href`, like the <{a}> element's <{a/href}> attribute.
Expand Down