Does jQuery internally convert HTML5 data attribute keys to lowercase?

后端 未结 2 1529
星月不相逢
星月不相逢 2020-12-03 01:17

I am trying to conform my JavaScript coding style to my Zend coding style as much as possible, which is using camelCase. So, in my HTML5 data attributes, I am naming them a

2条回答
  •  刺人心
    刺人心 (楼主)
    2020-12-03 01:58

    First off, see this part of the source code of JQuery, it assumes you have lower case attributes.

    Secondly, by convention, all HTML5 attributes should be lowercase, see: http://www.htmlbasictutor.ca/html-tag-attributes.htm

    Finally, be warned you may encounter futher problems if you insist on using upper cases, see Django: Unable to add UPPERCASE attribute name in HTML input element

提交回复
热议问题