开发者

Is there a standard way to add a list of values to an HTML5 data attribute?

开发者 https://www.devze.com 2023-03-07 03:32 出处:网络
Is there a standard way of adding a list of values to an HTML5 data attribute? Example: &l开发者_JS百科t;div id=\"Larry_King\" data-exwives=\"Freda Miller, Annette Kaye, Alene Akins, Mary Francis Su

Is there a standard way of adding a list of values to an HTML5 data attribute?

Example:

&l开发者_JS百科t;div id="Larry_King" data-exwives="Freda Miller, Annette Kaye, Alene Akins, Mary Francis Sutphin, Sharon Lepore, Julie Alexander, Shawn Southwick" />

I plan on doing this via a comma separated list, but was wondering if there is a standard.


There is no standard, because HTML5 itself is not yet standardized. You are free to populate the data- attributes with data in a way that works best in your situation.

http://html5doctor.com/html5-custom-data-attributes/ provides some guidelines about what should and should not be used in data- attributes, and your example does not violate the "should not's".

0

精彩评论

暂无评论...
验证码 换一张
取 消