AngularJS gives the option of, but does not use the data- prefix in their examples or mandate the use of it. Should I include the data- prefix in my project and why?
Is it still valid HTML if I don't use data-*?
AngularJS gives the option of, but does not use the data- prefix in their examples or mandate the use of it. Should I include the data- prefix in my project and why?
Is it still valid HTML if I don't use data-*?
Many libraries like knockout, angular etc. do not use the data- prefix.
Knockout uses data-*: "<span data-bind="text: myMessage">
"
Angular uses data-*: "the directive can be prefixed with x-, or data- to make it HTML validator compliant" (shame they don't understand that it is for compliance with HTML and not with the validator).
Should i include the data- prefix ?
Yes, you should write valid HTML. If you are making up attributes, use data-
ones.