Bug Tracker

Opened 12 years ago

Closed 12 years ago

#2543 closed bug (fixed)

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.

Attachments (3)

patch.txt (8.4 KB) - added by flesler 12 years ago.
Diff with these changes.
vars.txt (10.2 KB) - added by flesler 12 years ago.
patch.txt is wrong, check any of these
vars.diff (10.2 KB) - added by flesler 12 years ago.
patch.txt is wrong, check any of these

Download all attachments as: .zip

Change History (5)

Changed 12 years ago by flesler

Attachment: patch.txt added

Diff with these changes.

Changed 12 years ago by flesler

Attachment: vars.txt added

patch.txt is wrong, check any of these

Changed 12 years ago by flesler

Attachment: vars.diff added

patch.txt is wrong, check any of these

comment:1 Changed 12 years ago by flesler

Owner: set to flesler

comment:2 Changed 12 years ago by flesler

Resolution: fixed
Status: newclosed

Implemented most at [5462] and [5463].

Note: See TracTickets for help on using tickets.