44
4

2 に答える 2

54

There isn't really, they're not 100% correct/valid usage in HTML4 of course....but they don't cause problems either, so they're still a great way to solve the "I need an attribute for this" problem.

If it helps, I've used these while supporting IE6 and have had zero issues thus far, and I can't recall a single SO question reporting any either.

于 2010-10-18T09:28:29.510 に答える
11

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.

于 2010-10-18T09:45:56.770 に答える