6 ms·
JQuery 1.7 Released
- suyash 15y agoVery interesting, the chart show significant performance gain in IE 7, 8 etc compared to the previous jQuery version. Congratulations.
- untog 15y agoThere is one ambiguous case: If the data argument is a string, you must provide either a selector string or null so that the data isn’t mistaken as a selector. Pass an object for data and you’ll never have to worry about special cases. I'm being picky I know, but wouldn't it just be easier to use something like: $("#div").on("click", { selector: "span", data: "blahblah", handler: function() }); Perhaps it's far too verbose, now that I've typed it out. But it just seems like it would do a good job of removing ambiguities like this.
- dmethvin 15y agoThe data feature isn't used that frequently, and when it is the best way to use it is by passing an object anyway. So although it's mentioned it is likely to be very uncommon.
- robin_reala 15y agoI use event data a lot, but I didn’t even realise you could pass a string.
- robryan 15y agoYeah, for bind and live I was under the impression that only an object would work from the docs.
- dmethvin 15y agoHaha, well it has always been documented to be an Object but turns out that there are a lot of people who don't read the documentation and pass strings or numbers. So rather than break their code in 1.7 we decided to document the fact that plain types can be used if you're careful.
- bergie 15y agoThe Create web editing interface uses event data a lot: https://github.com/bergie/create https://github.com/bergie/create
- scarmig 15y agoThe best thing is the new, unified event API. They've also improved event delegation performance by a factor of 2.
- ghc 15y agoThis makes me so happy. Those of us developing on Chrome 16 have been suffering through a storm of event.layerX/Y deprecation warnings. This new release fixes the issue and I can confirm the fix works like a charm.
- drewda 15y agoCan someone describe to me how these jQuery releases make their way into Rails 3.1 land? Does the maintainer of https://github.com/rails/jquery-rails https://github.com/rails/jquery-rails do an update and then it's up to us Rails users to execute a "bundle update"?
- ByteMuse 15y agoIt looks like jQuery versions get updated occasionally in that repo, but you'll have to check and see when 1.7 gets put in. My recommendation would be to maintain dependency versions yourself, i.e. download the version of jQuery you want to use and //= require jquery in application.js - then grab a new version of jQuery whenever you want it updated
- evanwalsh 15y agoI submitted a pull request with the update to 1.7, so hopefully it'll get released officially soon.
- nfm 15y agoCorrect. You could also manually download the latest jQuery and include it. The gem is a very thin wrapper around jQuery, jQuery UI and jquery_ujs, which basically makes the files available for inclusion in your manifests, and adds a jQuery specific helper method for your tests.
- nixme 15y agoYes, most likely. And hopefully the version number is incremented semantically so `bundle update` doesn't break anyone that really needs 1.6. If you haven't tried rails-behaviors[1], I recommend it. It's a modular, drop-in replacement for jquery_ujs, and I think @josh will update it shortly for 1.7 [1] https://github.com/josh/rails-behaviors https://github.com/josh/rails-behaviors
- joshpeek 15y agoThe quickest way to drop it in vendor/assets. Anything there will override any gems. so `//= require jquery` will just find your local copy instead. Shouldn't have to change any requires. curl http://code.jquery.com/jquery-1.7.js http://code.jquery.com/jquery-1.7.js > vendor/assets/javascripts/jquery.js
- clarkmoody 15y agoI can't wait for the Closure Compiler extern file for this new version!
- kenjackson 15y agoIs there a good set of jQuery tutorials that uses 1.7 (so you don't learn non-best practices)? I know it was just released, but these things are often built along with the development.
- dmethvin 15y agoThe docs site has a "What's new in jQuery 1.7" section that might help. As far as what is non-best practice, we'll be covering some of that in a blog post next week so stay tuned.
- kvnn 15y agoThere is nothing I see in the release notes that indicate you would develop non-best practices by using something like 1.6. Get to coding ;)
- vailripper 15y agoLove the delegate event performance improvements!
- vessenes 15y agoMy favorite part of the release notes: "Despite jQuery.isNaN() being undocumented, several projects on Github were using it. We have contacted them and asked that they use jQuery.isNumeric() or some other solution." This is an excellent reminder of how much things have changed in the last 10 years in our space; a popular tools vendor can go query a massive source code repository and reach out proactively for transitioning deprecated functions. Kudos to the jQuery team for the great attitude; and of course all hail github, but they know I feel that way since they charge my card every month. :)
- luriel 15y agoThis is one of the reasons why Google killing Code Search is so sad.
- igravious 15y agoBit of a me too post, totally agree, so sad.
- Flenser 15y ago"To optimize the code for the most commonly used forms of selectors, we examined a cross-section of code from Google Codesearch." I assume they found those github projects using code search. Code search may not be used a lot, but the people and projects using it have a large impact. Is there any way we can convince Google it's worth keeping it available?
- dmethvin 15y agoYes! Whenever someone on the jQuery team wonders, "But who does that anyway?" we turn to Google Codesearch. Often, we don't like the answers we find. But at least we find the answers. For example, the 600 occurrences of `$("document")` that should be `$(document)`. http://www.google.com/codesearch#search/&q=\$\%28\%22document\%22 http://www.google.com/codesearch#search/&q=\$\%28\%22doc...
- huskyr 15y agoI'm really excited about being able to load jQuery as an AMD module. This means you can load jQuery with RequireJS and write nice, modular code. I highly recommend anyone doing large-scale web projects to use Require, it changed the way how i write Javascript.
- weixiyen 15y agoAnyone have the documentation on jQuery.Callbacks?
- dmethvin 15y agoSorry, they're the last thing to be done and there was a lot to document because of its API surface. Addy Osmani did a writeup a few weeks ago: http://addyosmani.com/blog/jquery-1-7s-callbacks-feature-demystified/ http://addyosmani.com/blog/jquery-1-7s-callbacks-feature-dem...
- bad_user 15y agoOne thing I don't like about jQuery's evolution is the size. This version weights at 92K minified / 33K gzipped, which for mobile phones is a PITA.
- dmethvin 15y agoAgreed, and we plan to do something about it. There will be a jQuery blog post coming soon.
- kellishaver 15y agoI've been leaning more and more toward Zepto for mobile. It's still lacking a fair bit of jQuery's functionality, but the basics are there and the syntax is compatible. You lose a lot of IE/older browser support, but if you do some device sniffing and serve jQuery to desktops and Zepto to mobile devices, that's not really an issue.
- nicolsc 15y agoZepto is great if you're targeting iOS devices, or any webkit-based browser. But you'll need something else to handle Opera, which is 'quite' popular among mobile devices.
- alastair 15y agoWhy isn't there a tool that analyzes which functions / features of jQuery your project is using and generates a smaller library with only the stuff you need? I'm not really a developer so ignore if that's not possible / makes no sense.
- lucianof 15y agoThat plus server-side browser sniffing to serve only what the user's browser needs could result in an extremely reduced file size. But of course the PITA would then be to maintain that.
- JoachimSchipper 15y agoGoogle's Closure compiler can apparently do that.
- HeroNote 15y agoFree jQuery & jQuery UI eBook (Reference Manual) has been updated: http://www.heronote.com/files/jQuery.htm http://www.heronote.com/files/jQuery.htm
- brunnsbe 15y agoIt's always nice with new features and enhancements but some bugs should first be fixed, like e.g. this one (i cannot update my code to a version higher than 1.5.x due to customers still using IE7): http://bugs.jquery.com/ticket/9646 http://bugs.jquery.com/ticket/9646
- raleec 15y agoHear hear. I had to work around this insidious creation http://bugs.jquery.com/ticket/8205 http://bugs.jquery.com/ticket/8205 It creates a memory leak (it hit my getJSON calls) that slowly strangled one of my apps until it crashed the browser. I list a lot of hours on that one...
- dmethvin 15y agoWe closed a huge number of bugs in 1.7, but yes there are about 100 open bugs plus another roughly 100 more that are either feature requests or unverified. For a project the size of jQuery and considering the installed base, I think that is pretty good. And the way these bugs get fixed is by someone spending a lot of time to track them down. As the 1.7 blog post mentions, we definitely welcome any help we can get. We are all volunteers so we don't have the time to quickly track down and fix every bug. In the triage process we put priority on fixing the worst bugs that affect the most people. I personally triaged both #9646 and #8205 so we could mark them as verified, but tracking down and solving older-IE problems can be torture given the crude stone debugging tools available in those environments. If you have a high threshold for pain, we could certainly use your help.