Permalink
Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
26 lines (21 sloc) 626 Bytes
<!doctype html>
<html lang="en">
<head>
<title>JavaScript Patterns</title>
<meta charset="utf-8">
</head>
<body>
<script>
/* Title: context and find
* Description: better to choose `find` over `context`
*/
var arms = $('div.robotarm', '#container');
$('.reply_form', $(this).closest('.comment')).hide();
// no performance gain over doing this, but a preferred pattern for readability reason
var arms = $('#container').find('div.robotarm');
$(this).closest('.comment').find('.reply_form').hide();
// References
// http://paulirish.com/2009/perf/
</script>
</body>
</html>