-
Notifications
You must be signed in to change notification settings - Fork 46
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
HTML: IDL attributes and HTML attributes should be kept in sync #279
Comments
There's several subtleties here, but I agree with the general advice, and especially on the cases to avoid. Some things that come to mind:
|
The one thing I would add to the above is that modifying the node tree (as happens with But yeah, I definitely agree that naming the content attribute |
Could we say something like the following?
|
As I wrote in #289 (comment) there is a lot of value in exposing state via (read/write) attributes, so I would be wary of introducing such guidance which prioritizes spec writers and implementors over authors ("Avoid adding content attributes for dynamic state"). Agreed with points 1 and 3. |
Also agree with points 1 and 3. |
I am still a bit worried about synching state when that involves firing events during parsing, or user input. We could postpone these events till after finishing parsing, but then what about web components? Do it after elements are upgraded? We already have issues with user input on the web today as people do processing on each key stroke instead of when the user is taking a small break, so additional processing will make this slightly worse |
Following today's breakout discussion, we can all agree that IFF an IDL property and an HTML attribute have the same name, then they should definitely be in sync and we should have a principle about this as violating this has caused a lot of confusion over the years. However, whether an IDL attribute should be reflected in an HTML attribute at all (which is what a lot of this discussion has centered around) is the subject of #289, not this issue. |
* Initial commit for #279. * Update index.bs Co-authored-by: Lea Verou <lea@verou.me> * Update index.bs Co-authored-by: Theresa O'Connor <hober@apple.com> * Update index.bs Co-authored-by: Theresa O'Connor <hober@apple.com> * Update index.bs Co-authored-by: Theresa O'Connor <hober@apple.com> * Added counterpattern examples. * Update index.bs Co-authored-by: Lea Verou <lea@verou.me> Co-authored-by: Lea Verou <lea@verou.me> Co-authored-by: Theresa O'Connor <hober@apple.com>
* Initial commit for #279. * Update index.bs Co-authored-by: Lea Verou <lea@verou.me> * Update index.bs Co-authored-by: Theresa O'Connor <hober@apple.com> * Update index.bs Co-authored-by: Theresa O'Connor <hober@apple.com> * Update index.bs Co-authored-by: Theresa O'Connor <hober@apple.com> * Added counterpattern examples. * Update index.bs Co-authored-by: Lea Verou <lea@verou.me> Co-authored-by: Lea Verou <lea@verou.me> Co-authored-by: Theresa O'Connor <hober@apple.com>
This relates to #269.
In the future, we should avoid cases like
<input value>
,<option selected>
,<input checked>
etc, where the HTML attributes were never updated, and it was only the IDL attributes that reflected current state. This was incredibly confusing to teach, and the cause of a lot of buggy code.Instead, the more recent trend has been to keep them in sync, e.g.
<details open>
is updated accordingly asHTMLDetailsElement#open
is modified. I propose we ensure this trend continues by making it a design principle.The text was updated successfully, but these errors were encountered: