ded / bonzo

library agnostic, extensible DOM utility
Other
1.32k stars 137 forks source link

Data method is not camelcasing hyphen separated properties #131

Closed mariomc closed 10 years ago

mariomc commented 10 years ago

The data method doesn't camelize hyphen separated properties.

If you, for instance, call bonzo(document.body).data('foo-bar', 'baz'), the result from bonzo(document.body).data() returns { 'foo-bar' : 'baz' } instead of { 'fooBar' : 'baz' }.

Is this a bug or a feature?

ryanve commented 10 years ago

I'd say feature. I'm open to either I guess. I rarely use the get-all syntax except for inspection. To me it makes sense for the keys to be exactly like you set them (unlike how jQuery camelCases them).

ded commented 10 years ago

i would never expect that to happen. data is data and should be retrieved the same way you set them, just like all document stores. the fact that jQuery does this is bizarre. sorry that this is a no-fix, hope this doesn't deter your development