garand / sticky

jQuery Plugin for Sticky Objects
Other
3.3k stars 1.06k forks source link

Some minor linting fixes and cleanup #173

Closed acconrad closed 9 years ago

acconrad commented 9 years ago

My team is using this plugin and I noticed a few places that needed to be cleaned up and optimized:

  1. A bunch of inconsistency with the use of strict equality (===). Strict equality should always be used when you're not dealing with falsey objects (i.e. null == undefined is permitted, so therefore obj == null or obj == undefined is permissible)
  2. There was a missing semicolon. Every other line ends with a semicolon, so that one needed one as well.
  3. A minor for loop optimization would be to cache the length of the for loop inside of a variable in the first portion of the loop. This saves having to call length every single time.While this is optimized in modern browsers, given you support legacy browsers, this is a worthwhile optimization.
garand commented 9 years ago

Thanks for contributing! Glad you're enjoying the plugin.