Permalink
Browse files

JS: optimize jQuery selector usage.

  • Loading branch information...
1 parent 1daeedb commit 08b9f218302c6a7162bc022932dfd89f3ea44136 @vdboor vdboor committed Jan 6, 2013
Showing with 5 additions and 4 deletions.
  1. +5 −4 fluent_comments/static/fluent_comments/js/ajaxcomments.js
@@ -25,12 +25,13 @@
$('html, body').each(function()
{
// See which tag updates the scrollTop attribute
- var initScrollTop = $(this).attr('scrollTop');
- $(this).attr('scrollTop', initScrollTop + 1);
- if( $(this).attr('scrollTop') == initScrollTop + 1 )
+ var $rootEl = $(this);
+ var initScrollTop = $rootEl.attr('scrollTop');
+ $rootEl.attr('scrollTop', initScrollTop + 1);
+ if( $rootEl.attr('scrollTop') == initScrollTop + 1 )
{
scrollElement = this.nodeName.toLowerCase();
- $(this).attr('scrollTop', initScrollTop); // Firefox 2 reset
+ $rootEl.attr('scrollTop', initScrollTop); // Firefox 2 reset
return false;
}
});

0 comments on commit 08b9f21

Please sign in to comment.