News for hackers. Stuff that matters.
Re:JQuery 1.5.1 released, includes full IE 9 support by arkitaip on Thursday February 24, 2011 @06:39PM (#2260341)
I am incredibly thankful that jQuery exists. The other day I had to code some basic javascript in a environment where embedding jQuery wasn't an option (too much overhead) - boy what a PITA. Basic stuff like writing selectors took forever and I had to resolve to "low level" coding. What would have taken a couple of seconds in jQuery took several hours of research, and trial and error. I planned on adding a basic fading/sliding effect - forget about it. Takes to much time in ordinary javascript.

So thanks John Resig and the rest of the jQuery dev team for making us web dev guys more productive and actually making JavaScript fun.

Re:JQuery 1.5.1 released, includes full IE 9 support by albertsun on Thursday February 24, 2011 @07:10PM (#2260427)
On the other hand... congrats! Now you know more about the inner-workings of jQuery and are a better javascript programmer.
Re:JQuery 1.5.1 released, includes full IE 9 support by abp on Friday February 25, 2011 @03:50AM (#2261568)
Question is for how long. I've written several thousand lines of native, cross-browser javascript some years ago and from time to time again. But i don't remember a lot of the workarounds, from the top of my head.

Fiddling with cross-browser support is something that my brain don't like to keep today, be it js or css. Things like jQuery for js and compass for css come in handy to brush over that. :)

Re:JQuery 1.5.1 released, includes full IE 9 support by JonnieCache on Friday February 25, 2011 @06:17AM (#2261821)
Remember that jQuery's selectors can be used separately: they're a wrapper around the Sizzle library. It's 5kb after minification and gzip.

http://sizzlejs.com/

Can't speak to the performance relative to JQuery or to raw javascript however.

Re:JQuery 1.5.1 released, includes full IE 9 support by dualogy on Thursday February 24, 2011 @11:10PM (#2261029)
jQuery too much overhead? What kind of environment was that?
Re:JQuery 1.5.1 released, includes full IE 9 support by bzbarsky on Friday February 25, 2011 @12:43AM (#2261211)
Pretty much any environment where you care about performance of your code, actually. A lot of the simple-looking jquery stuff is implemented with tons of indirection, branching, etc.

Just compare the work a browser has to do for something like:

  document.getElementById("foo").setAttribute("bar", "baz");
to the work needed for the jquery equivalent...

Now the good thing is that most consumers of jquery don't care about performance of their code (in that they're doing small enough amounts of stuff it doesn't matter much).

Re:JQuery 1.5.1 released, includes full IE 9 support by rimantas on Friday February 25, 2011 @04:35AM (#2261655)

  > Now the good thing is that most consumers of jquery don't
  > care about performance of their code
Many do, but more do care about cross-browser compatibility and when you need to support IE6,7 home-rolled code is not likely to cut all the research and effort that's embedded in jQuery.
Re:JQuery 1.5.1 released, includes full IE 9 support by rorrr on Friday February 25, 2011 @02:24AM (#2261380)
Out of curiousity I tested that particular statement, and you're right. Compared to

    $('#foo').attr('bar', 'baz');
your code is

30 times faster in Chrome 9

81 times faster in Firefox 3.6

Re:JQuery 1.5.1 released, includes full IE 9 support by mazuhl on Friday February 25, 2011 @10:13AM (#2262395)
47 times faster in Firefox 3.6.1 7 times faster in IE 8
Re:JQuery 1.5.1 released, includes full IE 9 support by ams6110 on Friday February 25, 2011 @10:04AM (#2262366)
In most cases, though, using jquery to do something like adding a class, or setting a value, is still plenty fast enough. We're talking about code that runs in the browser, where things move on human timescales. Don't optimize prematurely.
Re:JQuery 1.5.1 released, includes full IE 9 support by bzbarsky on Sunday February 27, 2011 @11:21PM (#2270022)
The problems start when you add a class to 10,000 elements on the page. And yes, I've seen pages doing this with jquery where the jquery overhead was what made the difference between a 20ms operation (not user-perceptible) and a 1s operation (very much user-perceptible).
Re:JQuery 1.5.1 released, includes full IE 9 support by tropin on Friday February 25, 2011 @06:12AM (#2261812)
Could you share your test code?
Re:JQuery 1.5.1 released, includes full IE 9 support by bradgessler on Friday February 25, 2011 @03:11AM (#2261470)
Bookmarklets
Re:JQuery 1.5.1 released, includes full IE 9 support by jcr on Thursday February 24, 2011 @07:02PM (#2260403)
I really do realize computer systems and software are primarily designed for normal people rather than the disabled. I also understand the vastly competitive world of web development and the advantages of having a cool looking, feature rich site.

None the less, I take offense to the part of jquery-ui that is hijacking the web browser UI. It is remapping keys and pointer usage (text selection). This should have never been allowed in the W3C and EMACscript (javascript) standards. Hijacking the browser UI of a disabled person is like kicking the crutches out from under someone just to see them fall and because you think it will make you look cool to others.

Web developers never know how a user-agent is configured and never know the needs of the person using the web browser. Changing how the UI normally works really does hurt, confuse and infuriate many people, and probably more than just the disabled folks.

Sure, disabled people are a very small part of the population, and they typically are not the rich consumers buying the latest and greatest. They may not be your target market, your real customer concern, but excluding them with browser hijacking is unnecessary, and in some ways unfair.

At least please think over...

Re:JQuery 1.5.1 released, includes full IE 9 support by jeresig on Thursday February 24, 2011 @08:35PM (#2260647)
I'm not really sure what you're responding to, specifically. You do realize that jQuery UI (and jQuery Mobile) are both ARIA compliant, right? This means that it's actually far easier to use these UIs then you might expect.

ARIA is very cool stuff - definitely recommend that you check it out! http://www.w3.org/TR/wai-aria/

Re:JQuery 1.5.1 released, includes full IE 9 support by jcr on Thursday February 24, 2011 @09:38PM (#2260808)
John, it might be a day or four for me to type them up, but I mail you the test cases, configs, code and details where jquery-ui breaks when it hijacks the UI of the browser. I've tracked the problem to a faulty assumption, namely assuming the user-agent doesn't already have any existing user specified key bindings defined for special needs access. The conflict breaks all key bindings, including the defaults.
Re:JQuery 1.5.1 released, includes full IE 9 support by ez77 on Friday February 25, 2011 @05:20AM (#2261746)
but I mail you the test cases, configs, code and details where jquery-ui breaks when it hijacks the UI of the browser

This technical part is the most relevant as a public comment/link in HN, in my opinion.

Re:JQuery 1.5.1 released, includes full IE 9 support by arkitaip on Thursday February 24, 2011 @07:16PM (#2260442)
Not sure that jQuery deserves to be blamed for shoddy interface coding. Any competent web developer knows that you always start out by designing your interfaces so that they work with scripts and plugins disabled [1]. If some - ok, most - devs choose to ignore this design principle then jQuery is hardly to blame.

[1] Obviously there are situations when it simply isn't possible to create fully accessible solutions. Sometimes our hands are tied by management, tech stack requirements, etc.

Re:JQuery 1.5.1 released, includes full IE 9 support by rhizome on Thursday February 24, 2011 @07:13PM (#2260436)
You're right on many points, of course, but hyperboles of cruelty like "kicking the crutches out...just to see them fall and...you think it will make you look cool" don't seem to be grounded in reality.
Re:JQuery 1.5.1 released, includes full IE 9 support by jcr on Thursday February 24, 2011 @07:21PM (#2260453)
Your criticism is fair, and I should have written something better. I won't edit the original and I'll stand by my mistake since it would make your comment seem off.

The thing to realize is I was REALLY trying to contain my temper when the hyperbole slipped out. It's tough be positive while share a perspective of frustration few developers ever see.

Re:JQuery 1.5.1 released, includes full IE 9 support by dualogy on Thursday February 24, 2011 @11:12PM (#2261039)
jQuery != jQuery UI
Re:JQuery 1.5.1 released, includes full IE 9 support by professortodd on Thursday February 24, 2011 @06:39PM (#2260344)
I know that the javascript purists don't like jquery, but I'm a big fan.
Re:JQuery 1.5.1 released, includes full IE 9 support by jherdman on Thursday February 24, 2011 @07:11PM (#2260433)
Really? Why ever not? What do they prefer?
Re:JQuery 1.5.1 released, includes full IE 9 support by r00fus on Thursday February 24, 2011 @07:20PM (#2260449)
Something lighter than 238kb. I remember when jquery first came out, and ExtJS was around that size (actually a bit larger) and one of the big popularity factors of jQuery was a much smaller library size.

Also some places like Apple have their own internal js frameworks and want folks who know and can code bare-metal js.

Re:JQuery 1.5.1 released, includes full IE 9 support by jeresig on Thursday February 24, 2011 @07:59PM (#2260553)
jQuery is not 238KB in any form that you would ship to a user. It is a 29KB minified and gzipped - which is a world of difference and perfectly acceptable for mobile use (likely smaller than most images you'll be using on your site, for example).
Re:JQuery 1.5.1 released, includes full IE 9 support by TNO on Thursday February 24, 2011 @10:52PM (#2260988)
Of course if you have IE6, gzip can be a problem.
Re:JQuery 1.5.1 released, includes full IE 9 support by Strom on Friday February 25, 2011 @01:38AM (#2261300)
If you have IE6, then gzip is the least of your problems.
Re:JQuery 1.5.1 released, includes full IE 9 support by TNO on Friday February 25, 2011 @11:34AM (#2262699)
Ah yes, blame the user. That's always the best policy.
Re:JQuery 1.5.1 released, includes full IE 9 support by ashconnor on Saturday February 26, 2011 @03:27PM (#2266440)
But he's blaming the browser.
Re:JQuery 1.5.1 released, includes full IE 9 support by krakensden on Thursday February 24, 2011 @07:44PM (#2260528)
There's Zepto.js.

For desktop browsers, use the Google CDN and your users probably won't download a thing. And for free, you get sane DOM interaction, and an enormous body of work papering over the differences between browsers.

Re:JQuery 1.5.1 released, includes full IE 9 support by trezor on Friday February 25, 2011 @04:37AM (#2261660)
For desktop browsers, use the Google CDN and your users probably won't download a thing.

And Google is one step closer to tracking everything everyone does on every website.

As if now forcing people to deploy Google Analytics on their websites if they want keyword data from Google wasn't enough, do we really want to help and encourage Google to get in a position where they effectively control the entire internet?

One company controls over 90% of internet search and referral and they actually have the power to kill any company they don't like. Right now they may be behaving, but what if some competitor comes along which is showing some edge? Can we trust Google to do the right thing?

Google also hosts files needed by a majority of websites. They also withhold information from you about you and your site and force you to register an account with them and deploy their software on your sites to get access to a subset of that information. And you are encouraging people to help that company get a stronger grip. For what benefit? At what cost? Sorry for not being a fanboy, but try looking at the bigger picture here.

Would you be OK with one company controlling the entire Internet if that company was Apple? If it was Microsoft?

Hosting your own 23kb jQuery file does not cost that much. Actually practically nothing. Not in terms of bandwidth and neither in terms of perceived performance. Unless you are hosting your website on a 36.6kbps modem, host your own. Do the web some good.

Re:JQuery 1.5.1 released, includes full IE 9 support by jonknee on Friday February 25, 2011 @02:09PM (#2263369)
> And Google is one step closer to tracking everything everyone does on every website.

As long as you link the right files (make sure you specify the specific version and not use the one to give the lastest), there are very long expires headers and Google will have no idea the vast majority of your users ever visited. A user just needs to visit one site using the same version of Google hosted jQuery and they won't have to download it again when visiting another site.

> Hosting your own 23kb jQuery file does not cost that much. Actually practically nothing. Not in terms of bandwidth and neither in terms of perceived performance. Unless you are hosting your website on a 36.6kbps modem, host your own. Do the web some good.

People aren't using Google CDN for the cost, but for the performance. A high percentage of user will have the file cached already, so the performance gain is quite significant. Doubly so in a mobile environment.

Re:JQuery 1.5.1 released, includes full IE 9 support by robryan on Thursday February 24, 2011 @07:53PM (#2260544)
I don't really get this viewpoint, you can load JQuery once then it's cached. Is a barely noticeable load time difference really worth the extra power and time saving you get from JQuery?
Re:JQuery 1.5.1 released, includes full IE 9 support by pjleonhardt on Thursday February 24, 2011 @08:00PM (#2260561)
I downloaded the minified version yesterday: 88kb. 1/3 the size of what you're claiming. You shouldn't be using the development version for production uses (no reason).
Re:JQuery 1.5.1 released, includes full IE 9 support by Refringe on Friday February 25, 2011 @08:40AM (#2262117)
And 88kb isn't even gziped. When it's actually downloaded from your (or a CDN's) server it's less than 30kb.
Re:JQuery 1.5.1 released, includes full IE 9 support by kenjackson on Thursday February 24, 2011 @08:25PM (#2260626)
If you use a CDN isn't it cached across multiple sites?
Re:JQuery 1.5.1 released, includes full IE 9 support by emehrkay on Thursday February 24, 2011 @08:59PM (#2260713)
MooTools. I hate jQuery's api, but Id rather use it than vanilla JS for the majority of the things that I do with JS.
Re:JQuery 1.5.1 released, includes full IE 9 support by wlievens on Friday February 25, 2011 @04:09AM (#2261611)
Just curious: what in particular do you hate about it?
Re:JQuery 1.5.1 released, includes full IE 9 support by emehrkay on Friday February 25, 2011 @09:18AM (#2262219)
I find it to be very confusing and difficult to do very complicated things with. You have methods like position, or height, or width that all deal with the element. But size deals with the size of the collection and not the element. There are multiple ways to add events/delegate events and some are frowned upon in favor of others. The plugin system doesn't allow you to make reference to the instance of the plugin (without what seems to be a hack), I really dislike the fact that you have to constantly wrap element in the jQuery object, even if they exist in a collection inside of a jQuery object, and I just dislike how it uses argument overloading for most of its methods (sometimes its an obj literal, sometimes it can be a string, if its a string then the args found in the obj liters go in this order after the string, etc)

But like I said, I would rather use it than have to come up with a bunch of cross browser supported js on my own. The guys behind the lib are clearly JavaScript rockstars :) while I am fan. I just find the lib's api and general approach to problem solving to be a bit wonky and dont really understand "the ease of use" that everyone touts it having.

Re:JQuery 1.5.1 released, includes full IE 9 support by ehutch79 on Friday February 25, 2011 @10:37AM (#2262469)
what's the problem with using the jquery selector? i mean you can always just assign objects to a variable like:

var elemt = $('#elementID')

and then you can call something like elemt.hide() or whatever.

Re:JQuery 1.5.1 released, includes full IE 9 support by fletchowns on Thursday February 24, 2011 @08:30PM (#2260637)
I would have thought the opposite - the more you know about JavaScript the more you will probably like jQuery!