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