3 ms·
The class attribute isn't just for styling though. See https://html.spec.whatwg.org/multipage/dom.html#global-attributes:classes-2 https://html.spec.whatwg.org
by lawtalkinghuman 4y ago
The class attribute isn't just for styling though.
See https://html.spec.whatwg.org/multipage/dom.html#global-attributes:classes-2 https://html.spec.whatwg.org/multipage/dom.html#global-attri...
> authors are encouraged to use values that describe the nature of the content, rather than values that describe the desired presentation of the content.
- sleepyhead 4y agoTIL! So those obnoxious JavaScript frameworks using classes for declaring logic are actually valid???!!
- sleepyhead 4y ago> values that describe the nature of the content vs > rather than values that describe the desired presentation of the content. Or could it be that the meaning here is that you should write descriptive classes such as 'alert-box' instead of 'red-box'.
- oneeyedpigeon 4y agoBut that gets your "not just for styling" property for free — now another component can use the knowledge that the element is an alert box.