命名为HTML5 custome数据属性规则(数据并行) [英] Naming rules for HTML5 custome data attribute(data-)

查看:152
本文介绍了命名为HTML5 custome数据属性规则(数据并行)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图用数据用户id ,但萤火显示为数据用户ID (以小写一世)。
如此看来,我们不应该使用自定义的数据属性大写字母。
什么是HTML5自定义数据属性的命名规则?
请让我知道的最佳做法来使用它。

I tried to use data-userId, but firebug shows it as data-userid (with a lowercase "i"). It seems that we should not use uppercase letters in custom data attributes. What is the naming rules for HTML5 custom data attributes? Please let me know any best practices to use it.

推荐答案

直接从<一个href=\"http://www.w3.org/TR/html5/dom.html#embedding-custom-non-visible-data-with-the-data-%2a-attributes\">the SPEC :

A 自定义数据属性是没有命名空间,其名称以开头的属性数据 - ,先后经过至少一个字符连字符,是 XML兼容,和不包含的uppercase ASCII字母的。

3.2.3.9 Embedding custom non-visible data with the data-* attributes

A custom data attribute is an attribute in no namespace whose name starts with the string "data-", has at least one character after the hyphen, is XML-compatible, and contains no uppercase ASCII letters.

(强调)

这篇关于命名为HTML5 custome数据属性规则(数据并行)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆