Bug Tracker

Ticket #2543 (closed bug: fixed)

Opened 1 year ago

Last modified 1 year ago

Useless variable (re)declarations

Reported by: flesler Assigned to: flesler
Type: bug Priority: minor
Milestone: 1.2.4 Component: event
Version: 1.2.3 Keywords:
Cc: Needs: Review

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

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

Change History

Changed 1 year ago by flesler

Diff with these changes.

Changed 1 year ago by flesler

patch.txt is wrong, check any of these

Changed 1 year ago by flesler

patch.txt is wrong, check any of these

Changed 1 year ago by flesler

  • owner set to flesler

Changed 1 year ago by flesler

  • status changed from new to closed
  • resolution set to fixed

Implemented most at [5462] and [5463].

Note: See TracTickets for help on using tickets.