使用HTML属性数据 - preFIX与否?属性、数据、HTML、preFIX

2023-09-13 04:53:16 作者:我真的很可爱

AngularJS给出的选项,但不使用数据 - preFIX在其实施例或授权使用它。我应该包括数据 - preFIX为什么?

解决方案   

许多图书馆像淘汰赛,角等不使用数据 - preFIX。

使用数据 - * :<跨度数据绑定=TEXT:myMessage>

使用数据 - * :指令可与X- pfixed $ P $或DATA-使它HTML验证标准(耻辱,他们不明白这是符合HTML而不是与验证)。

  

我应该包括数据 - preFIX?

是的,你应该写有效的HTML。如果您正在制作了属性,可以使用数据 - 那些

FME2017 用户参数和属性赋值

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 and why?

解决方案

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.