3 ms·
Guessing, but it's probably because $.fn.data is meant as a storage mechanism, not a DOM manipulation mechanism. Changing the DOM attribute would make it just t
by saraid216 13y ago
Guessing, but it's probably because $.fn.data is meant as a storage mechanism, not a DOM manipulation mechanism. Changing the DOM attribute would make it just that tiny bit more expensive and you can already use $.fn.attr to do the same thing.
- crescentfresh 13y ago$.data is tightly bound to the DOM however - much of jQuery is, in order to reduce developer friction - so this is just more jQuery api asymmetry IMO. To your point, performance is noble goal. Having some asymmetry is no big deal.
- codez 13y agoThanks for this saraid216 :) It's always good to know things like this. Thanks again!