3 ms·
never a good idea to camelCase html attributes :) (in case you didn't know, this won't work: $('form').attr('onlyOnce') but this will $('form').attr
by hamhamed 11y ago
never a good idea to camelCase html attributes :) (in case you didn't know, this won't work:
$('form').attr('onlyOnce')
but this will
$('form').attr('onlyonce')
if your attribute is written as onlyOnce
- boomlinde 11y agoMixed case in attribute names is perfectly valid HTML, and tag and attribute names are case insensitive. If jQuery attribute selection isn't, then maybe it should be considered a bug in jQuery. That's not to say that it isn't a bad idea, but I don't think the inconsistent behavior in jQuery should be considered in arriving at that conclusion.
- hamhamed 11y agono it's not valid html.. that's like saying writing gibberish is valid HTML. You can't read mixed case attribute names.. jQuery nor Javascript. It's always converted to lowercase without you knowing.
- boomlinde 11y agoYes, it's valid HTML. It's not at all like saying that writing gibberish is valid HTML. Why would you say these things without looking it up in the w3 reference (http://www.w3.org/TR/html-markup/documents.html#case-insensitivity http://www.w3.org/TR/html-markup/documents.html#case-insensi...) or just trying it out (http://5ccf7f9c97075d1b.paste.se http://5ccf7f9c97075d1b.paste.se)