I thought.
The DOM element may also refer to earlier when using the data, and this would not lead to a result (thus, we retain the DOM_Element-key-value relation).
Thus, the initial search for the “body” while storing the key value is the only performance, and subsequent data retrievals should not search for the “body” again:
b = $('body');
b.data('key', 'value');
alert(b.data('key'));
source
share