> In my opinion discard the data, saving the cost of a DOM access.
Afaik, setting/getting .data() does not include an additional
performance penalty (as in page reflow), since jQuery's global cache
object is used to store the data.
If a reference to the DOM element exists beforehand, ergo, no selector
query is performed, then:
$( elem ).data( 'arr', arr );
and
$( elem ).data( 'arr' );
perform well.
--
To view archived discussions from the original JSMentors Mailman list:
http://www.mail-archive.com/[email protected]/
To search via a non-Google archive, visit here:
http://www.mail-archive.com/[email protected]/
To unsubscribe from this group, send email to
[email protected]