HTML attribute "data-attribute" vs simple "custom attribute"

I usually saw html data-attribute(s) for adding certain values ​​/ parameters to the html element, for example, Bootstrap, which uses them to “link” to opening modal dialogs, etc.

<button type="button" class="close" data-dismiss="modal" aria-label="Close">

Now I see that the almost well-known CSS structure, Kube , widely uses a simple user attribute in its new version , for example:

<column cols="4">4</column> 

<span class="label label-black" outline bold>Black</span>

Other examples in action are visible, for example here .

I did not know that you could use simple user attributes, so I tried to find some source about this, and I found only this old similar question , in which there were noted almost (possibly) compatibility issues.

I am surprised that a CSS structure like Kube might use a similar solution if browser support can be so "fragile" ....

So my question is:

  • How good (= cross-compatible) is the Kube approach?
  • Is it safe to replace mine data-attributewith simple custom ones if, for example, I should only pass true / false values?

This last question is better described by example, so replace <span class="foo" data-boo='true'>Black</span>with<span class="foo" boo>Black</span>

+4
1

. :

  • .
  • ,

... , , CSS... , , , .

+5

Source: https://habr.com/ru/post/1611806/


All Articles