Google Groups

Re: [jquery-bugs-team] File Size Considerations


Timmy Willison Nov 16, 2011 4:57 PM
Posted in group: jQuery Bugs Team


On Wed, Nov 16, 2011 at 6:48 PM, John Resig <jer...@gmail.com> wrote:
Hi All -

Sorry I've been rather swamped the past couple weeks! I had some
thoughts regarding the recent file size/deprecation discussions. I
feel that our way of tackling the issue should be done in multiple
steps:

1) First and foremost, get jQuery working in Google Closure Advanced
Optimization mode. If we can get it so that a user can get a
super-stripped-down version of jQuery by adding in their site code and
jQuery itself this would be a major win - and one that would likely
solve most of the size concerns that we hear now.
 
I agree, but we still have the problem of defining functions with .each(), which we do a lot.


2) Deprecate and move bits of code that no one is using to plugins. A
bunch of these are in the spreadsheet (getData/setData,
.data("events"), etc.).

3) Start decoupling bits of internal logic to allow Closure to work
even better. For example, make sure that we're using as little of the
other methods in jQuery, inside core, to avoid pulling in external
modules. Right now I suspect that even a basic statement like
$(function(){ }); will pull in core, events, data, and a bunch of
other modules.

4) Figure out a way to ship a version of jQuery that only deals with
IE 8 and up. Namely: Figure out how to effectively strip out the
non-qsa bits of Sizzle and any bug fixes that may be not relevant.
 
This one concerns me for a few reasons.

- A major advantage to jQuery is the simplicity of a single file.  jQuery's usage is still growing and I think a single file has helped that along.
- Maintaining two jQuerys at once could be a pain.
- IE6-7 will still be around for a while longer and even if they were not supported, we would still need all of the non-qsa in Sizzle, if only to maintain the current implementation for filtering.
 
 
After all of this is done then we can start looking at removing things
that are inherently not ideal but are still being used. I worry that
we may be trying to drop not-ideal features just to get more filesize
- which shouldn't be our top concern, we still have a ton of work to
do to try and get filesize down in other ways.

If the response from the community has been anything it's been: Give
us a way to customize our jQuery build (closure compiler does this)
and give us a way to drop old browsers (slightly mis-guided, people
think we have more bug fixes than we actually do - I think closure
compiler will help a lot of this but we can still explore it anyway).

--John