Side navigation
#2543 closed bug (fixed)
Opened March 18, 2008 04:46PM UTC
Closed May 06, 2008 01:32AM UTC
Useless variable (re)declarations
Reported by: | flesler | Owned by: | flesler |
---|---|---|---|
Priority: | minor | Milestone: | 1.2.4 |
Component: | event | Version: | 1.2.3 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
Line 1920: ''var events = jQuery.data(elem, "events"), ret, index;''
index is never used.
Line 1559: ''var m = re2.exec(t);''
''m'' was already declared at line 1489, the 'var' is needless.
jQuery.merge, Line 1142:
''var i = 0;'' could be declared only once, less bytes, and the synthax is correct.
Line 750, 905,1593,1613,1704,1732: for( var i=0;
''i'' is already defined, just use i=0. 1704 also declares ''rl'', can be declared in the line above.
Inside jQuery.filter, Line 1665:
''tmp'' is declared twice, and with the same value ([]).
Just modify line 1666 to ''var last, tmp = [];'' and remove the other ones
Line 1729:
''last'' is already declared, no real gain here, but the ',' could be a ';'.
jQuery.swap, jQuery.each: ''for( var name in...''
''name'' is declared twice, better put it after ''old''.
jQuery.each: ''length = object.length''
This is done twice, and also checked in the if, could be cached only once at the start of the function.
Also, some variable declarations can be merged to be comma separated, that saves a few bytes.