D
D
dom1n1k2017-06-08 16:30:25
HTML
dom1n1k, 2017-06-08 16:30:25

What is the danger of using arbitrary attributes (not data-)?

I've been thinking - is it really necessary to use data-attributes?
For example, my library needs attributes. Logically, they should be given names like data-libname-attrname="value". The libname part plays the role of a namespace, attrname is the name of the attribute itself. There seem to be no problems here, but it's long - it's boring then to write this same data dozens of times in the html code. Why not just write libname-attrname="value"?
What threatens me with my own names? Well, besides the fact that it is generally accepted, valid and other semantic blah blah. Well, they use all sorts of Angulars, why am I worse?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Artem, 2017-06-08
@devspec

They do not threaten anything if they do not come into conflict with the existing ones.

A
Alexey Nikolaev, 2017-06-08
@Heian

It's ugly, misleading and doesn't meet accepted standards - reason enough to stop it. Also, data is part of the specification, which means it's valid, unlike all other custom attribute options. Validation with elements that are not in the spec will never pass.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question