> > Right now, the jQuery compressed build is teetering around 18-19KB, I
> > really want to try and cut this down. Any thoughts on particular
> > features that should be extracted into a plugin?
> > 
> I know the macros don't account for _that_ much core code but they do
> complicate the documentation significantly. We have nice short names like
> .attr and .css yet those represent the most-macroed properties. Then we
> end
> up with (unjustifiable IMO) situations where valuable names like .height()
> are taken by the .css("height") macro to save five--count 'em--five
> characters. The same goes for the event macros, I think they account for
> more than half the names in the API documentation at this point and they
> end
> up creating situations like .unload() that are pretty hard to explain.
> 
> I would like to see jQuery take more of a Perl path than a PHP one, using
> a
> small number of consistent and powerful concepts plus the ability to
> extend
> things with plugins. Perl has one simple consistent regexp operator; PHP
> has
> two completely different regexp engines, each served by a dozen or more
> differently named functions.

Totally agree! The API contains way too much "convience" methods that makes it 
more complicate to find something. A more consistent approach, with only the 
css-method to access styles should be much more convinient on the long term.

There was the idea to provide a shortcut generator in the core and remove most 
default shortcuts. I think the proposed usage looked like this:

$.shortcut({
  css: ["height", "width"],
  attr: ["title"],
  bind: ["click"],
  unbind: ["click"]
});

That would create shortcuts available as height() and width(), title(), 
click(), oneclick(), onemouseover() and unclick(). Without them, you have to 
use the plain methods, eg. css("height"), attr("title"), bind("click") or 
unbind("click").

Dunno how to handle the current oneEvents like oneclick: Extending bind with an 
additonal parameter for the number of events to handle before the handler 
should be removed would be one way, another to add a bindAmount() or binds().

Extending bind() is troublesome because we want to extend that anyway to allow 
additonal arguments passed to the event handler.

--
Jörn Zaefferer

http://bassistance.de
-- 
"Ein Herz für Kinder" - Ihre Spende hilft! Aktion: www.deutschlandsegelt.de
Unser Dankeschön: Ihr Name auf dem Segel der 1. deutschen America's Cup-Yacht!

_______________________________________________
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/

Reply via email to