jQuery.data caching of 'data-*' attributes
I could be off-base here, but from what I've gathered looking at jQuery's data method, I am very surprised with how it caches data attributes.
In essence, if you are setting 'data-something' attributes on elements, you cannot rely on $.data('something') to retrieve the current value. jQuery caches the attribute value in its internal data store, and since jQuery prefers internally stored data over element data attributes, subsequent calls to $.data('something') always return the initial (cached) value.
I understand that jQuery will cache the attribute if set with $.data('key', 'value'), but I am honestly surprised that simply retrieving a value caches it. I assume this is on purpose? What is the reasoning behind this decision?
(I don't mean to sound demanding, if I come across that way. You guys/gals have a wonderful library here, and, as always, expectations will differ among the masses.)