jQuery 1.8: The Big Squeeze
 Share
The version of the browser you are using is no longer supported. Please upgrade to a supported browser.Dismiss

 
$
%
123
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
|
 
Still loading...
ABCDEFGHIJKLMNOPQRSTU
1
1) Don't be alarmed, this is a starting point for discussion.
2
2) Deprecation is reversible or deferrable, but removal requires notice. So when in doubt, deprecate.
3
Inspiration:
4
http://mathiasbynens.be/demo/jquery-sizeTHE DOCUMENT YOU ARE READING: http://goo.gl/Vzaxa
5
6
7
General thoughts on space-focused refactor
8
Can we refactor to allow basic ajax functions without the need for $.ajax/Callbacks/Deferreds? Basically expose the transports in some bare form.
9
How will this affect UI and Mobile? Make our reduced subset work with them (esp Mobile) so they get the reduced size benefit
10
Whenever we deprecate, we should note the version number of the deprecation in the comments
11
12
FeatureDeprecateRemoveSavingReplacementReasoningVolunteer
13
33,288Gzip 1.7 size
14
EVENT
15
Global events e.g., $("#el").ajaxReady(...)-40$(document).ajaxReady(...) or (leaky) COMPAT PLUGINavoids expensive groping event list; simplifies event/data code and api docs
16
data events (setData, getData)-94pub/sub or pluginexpensive performance, undocumented, and strange
17
exclusive events ("click!")-35noneundocumented forever, only used by data events afaik
18
$().bind("ready")-17$.ready(fn) ready semantics don't match event semantics; error-prone
19
"hover" pseudo-event-54"mouseenter mouseleave"semantics (hover != mouse passing over); confused with .hover() method, breaks use of a real "hover" event
20
.live(), .die()1.7-46.on() or .delegate()Bad semantics, error prone and hard to understand; see docs page
21
load() unload() error()-12.on("NAME", fn) or .trigger("NAME")rarely-used shorthand methods; .load() is ambiguous with the ajax method; jQuery.fn.error and jQuery.error are not related
22
event.attrChange attrName relatedNode srcElement wheelDelta1.71.8-27event.originalEvent.NAMEnon-standard browser-specific properties, copying wastes time
23
ATTRIBUTES
24
1.6.1 boolean attr hacks-141.prop()simplifies .attr() and makes API consistent, faster, smaller
25
value attrHook1.71.8-45noneUnnecessary and .attr('value') does nothing special without its removal
26
tabIndex attrHook-4noneFixes selector compat and is consistent with attr's purpose
27
AJAX
28
jqXHR.complete success error1.7-28jqXHR.always done failmake consistent with Deferred (why do we need completeDeferred?)
29
SELECTOR
30
:file :image :password :radio :reset :submit :text :button-213input[type=WHATEVER]allow use of qSA, be standard
31
CSS
32
jQuery.curCSS1.5-10jQuery.csshttp://google.com/codesearch#search/&q=.curCSS%5C(&type=cs seems to only turn up jquery.js itselfmikesherov
33
MANIPULATION
34
35
CORE
36
jQuery.browser1.41.9-215OFFICIAL PLUGINnot good practice, hard to maintain, NOT maintainedrwaldron
37
deferred.isResolved isRejected1.71.8-14deferred.stateboolean methods suck
38
.pushStack() selector maintenance-93none; mainly a debugging thingwasn't/can't be maintained for arbitrary manipulation/traversal; used by .live()
39
.sub()-187OFFICIAL PLUGINhttp://google.com/codesearch#search/&q=(\$|jQuery)\.sub\(rwaldron
40
41
DATA
42
.data("events")1.71.8-27jQuery._data(elem, "events")We've already asked, few legit uses beyond debugging
43
TRAVERSING
44
$().closest(Array)==>Array1.71.8-56nonereally an internal function, used by old live-event code
45
46
-1,358Total savings
47
31,930Theoretical reduced size
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
Loading...
 
 
 
Sheet1