whatwg / html

HTML Standard
https://html.spec.whatwg.org/multipage/
Other
8.17k stars 2.69k forks source link

Disambiguate attribute declarations from content attributes #10756

Open sideshowbarker opened 1 week ago

sideshowbarker commented 1 week ago

The change updates the spec to use the term “attribute declaration” in all cases where what the spec is referring to is actually the syntax for declaring attributes in markup.

Otherwise, without this change, the spec uses the same term “attribute” to refer both to attribute declarations in markup and to actual content attributes as they exist in the DOM.

And we have evidence of authors being confused due to that ambiguous use of the same term to refer to different things — and evidence suggesting the ambiguous usage promotes the wrong mental model of HTML for authors.


/forms.html ( diff ) /index.html ( diff ) /indices.html ( diff ) /introduction.html ( diff ) /parsing.html ( diff ) /syntax.html ( diff )

zcorpan commented 4 days ago

If we do this I think we should change all of the syntax terms similarly:

Maybe this makes it easier to separate the syntax vs DOM concepts, but it also makes it more wordy to talk about the syntax.

The HTML parser's tokenizer produces data structures with similar names but are distinct to both the DOM and the syntax concepts.

Start and end tag tokens have a tag name, a self-closing flag, and a list of attributes, each of which has a name and a value.

It would be incorrect for the tokenizer terms to link to the syntax terms.