Skip to content

Commit

Permalink
Merge pull request chuanxshi#74 from Sid3Show/master
Browse files Browse the repository at this point in the history
Prefix selector caches with a dollar symbol
  • Loading branch information
chuanxshi committed Jun 16, 2013
2 parents adb7570 + 9b7afbf commit 8331496
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions jquery-patterns/cache-selector.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,16 @@


// preferred
var photo;
var $photo;
// prefix the cache with $ to help identify it as a selector cache later
$('.list-item').click(function () {
photo = photo || $('.photo');
photo.hide();
$photo = $photo || $('.photo');
$photo.hide();
});


// References
// http://ejohn.org/blog/learning-from-twitter/
</script>
</body>
</html>
</html>

0 comments on commit 8331496

Please sign in to comment.