HTML5 custom attributes - Why would I use them?

后端 未结 4 1490
萌比男神i
萌比男神i 2020-12-06 05:13

I can\'t seem to understand why I should be happy with HTML5 allowing custom attributes? Why would I use them?

4条回答
  •  借酒劲吻你
    2020-12-06 05:45

    Custom attributes are already widely used, for example here's an example from dojoToolkit():

    Lorem ipsum and all around...
    Lorem ipsum and all around - second...
    Lorem ipsum and all around - last...

    This could now be re-written so that the markup validates using attributes like data-dojoType. They also allow you to store application specific data in your tags rather than hacking around in the class attribute.

    There's a good introduction to data-* attributes on HTML5 Doctor.

提交回复
热议问题