Html5 data attributes backward compatibility

I read user data attributes for html web pages ( one example of many ). From what I can say, this is most likely the best solution.

<div data-my_attrib="stackoverflow"></div> 

My question is about backward compatibility.

Presumably, the html standard states that unknown attributes should be ignored (I read this comment several times, actually did not read the standard itself: P), but are there any known browsers (including past versions, both mobile and On PC), which may have problems with the new specification of special attributes? If so, which ones?

Also, are there any known issues for which data-something might already be defined for older browsers ( something is an arbitrary placeholder)? The main focus is on the main functions of the browser (including standard add-ons that come with the browser), ignore website scripts / libraries such as jQuery, etc.

+4
source share
2 answers

Unknown attributes are ignored because they do nothing, but they are available for getAttribute to retrieve.

I’m sure that we can safely assume that data-* not used for anything else - otherwise they would choose a different keyword for identification that does not conflict with anything else.

+4
source

There are no known backward compatibility issues for data-* attributes, of course, not with any browser that you are likely to encounter.

The entire "broken browsers" article is not one of the HTML5 guidelines.

+3
source

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


All Articles