Here are some optimizations and inconsistencies I spotted in 1.8RC1. They are low priority (no functional change) but may be worth looking at/fixing. Thanks!
proxy.guid can be removed.
.toString is used here, but
+ "" is used everywhere else.
$.nodeName can be private, also makes for smaller gzip size.
.func used in several places; it could be cached. Also inconsistent uses between
$.fn.domManip, a new array is even created on each call.
!== used almost everywhere (except for
null), but some places where
!= is used for no specific reason:
cur != this)
$.ajax (when setting
cache != cache.window)
arguments.length == 1), also no space before
- There is
$.uuid. These could perhaps be melted together as they are both used in a
core_pnum can be a string; a regexp with
.source are unnecessary. Sizzle uses strings for partial regexps as well.
$.fn.toArray = core_slice; would work equally well because the
this value is inferred.
indexOf is inconsistently used with
>= 0 and
- In the
json jsonp prefilter,
indexOf is used directly with a
! which may not be what the code is intended to do (?)
if(!elem) bailout can be placed before the number to string conversion as there is no number that evaluates to the empty string. This would make for an earlier bailout.
typeof check could be placed after the functions check as it's not used by the function check at all. Perhaps it could be replaced with
arguments instead, so that truthy/falsy values are allowed as well.
Change History (11)
set to gibson042