

JQuery.ish - A Simpler jQuery - jameswyse
https://github.com/bshack/jQuery.ish

======
huskyr
I don't get it. The featureset on this project is so small that for anything
else than a simple testpage it won't be good enough. And for a case like that,
you can simply do vanilla DOM scripting yourself. If you want a library that's
like jQuery but smaller simply use Zepto.

~~~
ashconnor
"In short, Zepto is expected to work in every modern browser and browser-like
environment, except for Internet Explorer."

I can write off that idea then.

~~~
huskyr
If you want a library that both supports older and newer browsers you need
jQuery.

But you could load Zepto if the browser supports it, and otherwise load jQuery
because their API is the same.

------
mistercow
What I want is a jQuery-like library that can dynamically load alternative
versions based on the browser in use, so that modern browsers load something
close to zepto, while IE6 loads all the fixin's.

~~~
huskyr
Put this in the end of your html file in a <script> tag

    
    
      (function() {
        var src = (document.querySelector) ? '//zeptojs.com/zepto.min.js' : '//ajax.googleapis.com/ajax/libs/jquery/1.7/jquery.min.js';
        document.write('<script src="' + src + '"><\/script>');
      })();
    

This will load Zepto if the browser supports it, and jQuery otherwise.

------
cageface
It seems like only yesterday that jQuery was the simple, lightweight
alternative. I wonder how long it will be before things like this and Zepto
add enough features to earn accusations of bloat.

------
bentlegen
"This project is NOT to ... create a plugin that is more than 500 bytes
minified and gzipped"

It's already at 483 bytes. Where do you go from here?

~~~
amyhackernews
I'd personally be pretty happy with < 2K. The main things I use jQuery for
are: 1) selecting nodes (especially children of selected nodes), 2)
manipulating node attributes, 3) AJAX, 4) extend(), 5) animating CSS, 6)
normalizing some events.

~~~
latch
That feature set sounds like zepto, which comes in at 8.4K. If it supported
IE9, it'd be pretty killer.

------
astrodust
It'd make everyone's life a lot easier if these selector methods were simply
baked into the browser in a standardized way.

------
buddydvd
Can Google Closure Compiler compile an app with jQuery but only include parts
of jQuery that the app depends on?

~~~
ehsanu1
Yes, but not directly (jQuery is not written in a compatible way for dead code
removal). Instead, use <https://github.com/zgrossbart/jslim>

~~~
buddydvd
This is great. Thanks for the link! The example in the readme suggests that
jslim can reduce simple apps combined with jQuery by up 28%. I wonder if it
can achieve more if jQuery was modified to let you specify selectors by
function calls instead of selector string. For calls like $("a.button"), the
static analyzer may have trouble removing unused code such as the parts that
deal with descendant selector, ID selector. If selectors where specified as
function calls like $.find($.byTag("a").byClass("button")), static analyzer
may identify and remove more dead code. Though it probably isn't worth the
effort if the code requires such drastic modifications.

------
oelmekki
Wait... dependency on querySelectorAll ? Weren't the point of javascript
libraries to be crossbrowser ?

~~~
mkmcdonald
"cross-browser" is a misnomer that seems to have been invented by DOM library
authors as a marketing tool.

If we're talking about the _en vogue_ subset of browsers, then QSA has
support. If we're talking about a set of browsers where a usable DOM
implementation is provided (most dating back to Netscape), then, no, support
is not provided.

"Works in all browsers" should be closer to the latter, not the former.

