[eE]
is overkill while all regular expressions incorporating pnum
are theirselves case-insensitive.
Values are currently true
(e.g., jQuery.cssNumber.lineHeight === true
). Replacing them with the still-truthy " "
would allow for references like jQuery.cssNumber[ prop ] || "px"
instead of jQuery.cssNumber[ prop ] ? "" : "px"
.
We may have encouraged people to extend jQuery.cssNumber
theirselves, in which case the size benefit is probably too small to outweigh the breakage.
Combining jQuery.isFunction
with subsequent invocation was rejected in jquery/jquery#828, but partly because of a naming convention that didn't take off.
.stop
and .finish
are very similar, and could be merged or include even more repeated strings.
Unlike jQuery.map
and jQuery.grep
, jQuery.each
gives callbacks the array index/property name first. There's no fixing the existing method, but there's also nothing stopping us from introducing a new one (e.g., jQuery.loop
). Internal use (e.g., no more function( _, arg ) {
) might even make the size change a net benefit.
There may be a performance penalty for passing around arguments
objects, even to Array.prototype.slice
(1, 2, …). If so, we can slice manually with a loop.
- Simplify the
Data
prototype- Remove unused
discard
method - Remove unused
initial
arguments - Fold
register
method intocache
- Consider changing
cache
to return falsy instead of object whenaccepts
fails - Merge array/string paths in
remove
(e.g.,if ( !jQuery.isArray( key ) ) { key = key.match( rnotwhite ) }
) delete
instead ofregister
forremove( owner )
; remove writability fromdefineProperty
call- Add a method for conditional set (e.g.,
dataPriv.get( owner, key, defaultValue )
)
- Remove unused
- Simplify
cloneCopyEvent
:- Consolidate "user" and "private" data variables
- Use
access
to inferhasData
- Repeat the
srcData = cache.access( src ); destData = cache.set( dest, srcData )
pattern for both private and user data