Because you can use valid custom attributes instead:
<div data-customer-id="3" class="customer"> [...] </div>
If you prefix your attributes with data-
they are valid HTML. The reason for not just writing your own attributes is that they can wind up inheriting meaning in the future. Obviously this is unlikely for some cases (like "customer-name"), but using the prefix is safter.
Another added benefit is that you are very clear about your intentions; another developer isn't going to come by and think you meant to write kind="text"
rather than type="text"
when you were trying to mark the model associated with a particular input field.
你知道[数据属性](http://www.w3.org/TR/html5/elements.html#embedding-custom-non-visible-data-with-the-data-attributes)吗? – 2011-02-28 15:54:56
“......但是有没有很好的理由(除了这是无效的),为什么我们不应该这样做?” ...这就是微软的Internet Explorer开发人员在几年前说过的......:D – vtortola 2011-02-28 15:56:25
[Custom attributes - Yay or nay?]的可能重复(http://stackoverflow.com/questions/992115/custom-attributes- yay-or-nay) – 2011-02-28 15:58:43