Ticket #12229 (closed feature: fixed)
|Reported by:||anonymous||Owned by:||gibson042|
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: proxy.guid can be removed.
- $.trim: .toString is used here, but + "" is used everywhere else.
- $.camelCase and $.nodeName can be private, also makes for smaller gzip size.
- .func used in several places; it could be cached. Also inconsistent uses between .func and Array.prototype.func. In $.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:
- $.event.dispatch (cur != this)
- $.ajax (when setting crossDomain)
- $.removeData (cache != cache.window)
- $.fn.undelegate (arguments.length == 1), also no space before ?
- There is $.guid and $.uuid. These could perhaps be melted together as they are both used in a .guid++/.uuid++ fashion.
- 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 > -1, >= 0 and ~.
- In the json jsonp prefilter, indexOf is used directly with a ! which may not be what the code is intended to do (?)
- In $.clean, the 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.
- In $.fn.toggle, the 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.
- Owner set to gibson042
- Priority changed from undecided to low
- Status changed from new to assigned
Note: See TracTickets for help on using tickets.