Link to the CSS Values 5 specification, where it describes how HTML attribute names can be referenced in CSS properties.
6.4. Attribute References: the attr() function
https://drafts.csswg.org/css-values-5/
With the ability to specify attribute types, including dimension units, and to provide a default value - it does look like a new way to connect HTML to CSS beyond the limitations of classes.
---
> The data- prefix can be a little unwieldy but it allows for the widest compatibility with tools and frameworks. Using attributes without some kind of namespace can be a little dangerous, as you risk clobbering HTML's global attributes, but as long as your attribute name has a dash it should be quite safe.
I wonder if this last part is true. For custom elements, since they're required to have a dash, I imagine future HTML tags are guaranteed to not contain a dash. But for attributes..
Are all future HTML global attributes guaranteed to not include a dash?
Maybe the author means, as long as your custom attribute has a name with unique prefix, it should be "quite safe".
6.4. Attribute References: the attr() function
https://drafts.csswg.org/css-values-5/
With the ability to specify attribute types, including dimension units, and to provide a default value - it does look like a new way to connect HTML to CSS beyond the limitations of classes.
---
> The data- prefix can be a little unwieldy but it allows for the widest compatibility with tools and frameworks. Using attributes without some kind of namespace can be a little dangerous, as you risk clobbering HTML's global attributes, but as long as your attribute name has a dash it should be quite safe.
I wonder if this last part is true. For custom elements, since they're required to have a dash, I imagine future HTML tags are guaranteed to not contain a dash. But for attributes..
Are all future HTML global attributes guaranteed to not include a dash?
Maybe the author means, as long as your custom attribute has a name with unique prefix, it should be "quite safe".