Is there any problem with using HTML5's “data-*” attributes for older browsers?

前端 未结 2 1627
灰色年华
灰色年华 2020-11-30 09:36

I want to associate some custom data with some HTML nodes. I was going to use the new HTML5 style \'data-*\' attributes. e.g.:

2条回答
  •  余生分开走
    2020-11-30 10:09

    Internet Explorer and Microsoft has added several custom attributes that are not valid HTML4. Browsers don't check the element attributes against a specification, you can name an attribute roryscoolinfo="hello" if you like (though you shouldn't).

    The Dojo Toolkit adds its custom dojo* attributes.

    It's fine to use data- today, with a HTML5 doctype.

提交回复
热议问题