Is there a standard way to add a list of values to an HTML5 data attribute?
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".
精彩评论