Created
August 15, 2014 13:48
-
-
Save CamdenSegal/711e18e98d161c40f57d to your computer and use it in GitHub Desktop.
jQuery selector cache plugin
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
jQuery.fn.findC = function( selector, reset ) { | |
var cache = this.data('jcache') || {}; | |
if ( reset || undefined === cache[ selector ] ) { | |
cache[ selector ] = this.find( selector ); | |
} | |
this.data( 'jcache', cache ); | |
return cache[ selector ]; | |
}; | |
$jqueryObject.findC( '.new-selector' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment