Simon Willison’s Weblog

Items tagged jquery in 2008

Filters: Year: 2008 × jquery ×

jQuery: Changeset 5990. “Added a new liveQuery/event delegation hybrid method”. Lets you add events that continue to work as new elements are dynamically appended to the DOM, e.g. $(’div’).live(’click’, fn). Works by adding an event handler to the root document element itself and relying on event bubbling. I have to admit I preferred the earlier proposal of $(’div’).delegate(’’..), which feels like it should have much better performance—anyone know of a good plugin that supports this? # 23rd December 2008, 12:22 pm

jQuery changeset 5985 (via) jQuery trunk has ditched browser sniffing in favour of feature testing, where a small suite of unit-test-like code blocks is used to detect whether a browser supports specific idioms. If the tests fail jQuery still makes assumptions about what the fix is, but it’s not hard to imagine the library eventually using code tests to ensure the fix will work as well. # 22nd December 2008, 10:58 am a flickr machine tag browser (via) Flickr recently added API methods for exploring the machine tags used by the community. Paul Mison has built a neat OS X Finder style interface for exploring them, using JSONP and jQuery. # 15th December 2008, 11:24 pm

Extending jQuery’s selector capabilities. I already knew this was possible, but the examples James Padolsey provides are eye-opening—I especially like his clever :data selector extension which lets you write CSS selectors that query against jQuery’s custom “data” DOM element storage in a manner similar to CSS2 attribute selectors. # 12th December 2008, 6:05 pm

Visual Event. External code loading bookmarklet that visualises the JavaScript events hooked up to the current page, and lets you view the source code of the event handling function for each one. Only works for events added by jQuery, YUI or MooTools since those libraries maintain a cache of event handlers that they add, to work around the standard DOM’s omission of handler introspection. # 10th December 2008, 3:38 pm

pyquery. “A jQuery-like library for Python”—implemented on top of lxml, providing jQuery style methods for manipulating an HTML or XML document. # 6th December 2008, 9:53 am

jQuery history plugin. I used this plugin to add back button support to a small Ajax app today, with great results. I tried it a while ago and it didn’t work in Safari, but someone has updated it since and now it works perfectly. # 7th November 2008, 5:32 pm

freebase-suggest (via) A jQuery plugin that performs auto-completion against the Freebase JSONP API, and allows the results to be limited to specific categories or subsets. # 24th September 2008, 11:58 pm

Django snippets: Orderable inlines using drag and drop with jQuery UI. Code example from my PyCon tutorial on customising the Django admin interface. # 13th September 2008, 12:19 pm

jeresig’s sizzle. Sizzle is a new selector engine (work in progress, no IE support yet) from John Resig, designed to be small, standalone, library agnostic and ridiculously fast. It should eventually replace jQuery’s current selector engine, but if it stays around 4KB it’s also going to be really useful for projects that don’t need the overhead of a full library. # 24th August 2008, 11:41 pm

Making queries faster isn’t in the critical path for improving the real-world performance of any Dojo apps I know of, and I bet the same is true for JQuery users. Reducing the size of the libraries, on the other hand, is still important. Now that we’re all fast enough, it’s time that we stopped beating on this particular drum lest we lose the plot and the JavaScript community continue to subject itself to endless rounds of benchmarketing.

Alex Russell # 22nd August 2008, 8:12 am

querySelectorAll in Firefox 3.1. John Resig benchmarks the various JavaScript libraries’ support for querySelelectorAll, and finds an impressive 2-6x performance improvement over native DOM traversal. It’s worth clicking through to John’s experimental plugin for adding support to jQuery, which does a clever trick using __proto__ to convert the collection returned by querySelectorAll in to a jQuery object in browsers that support it. # 21st August 2008, 9:50 am

Table Drag and Drop jQuery plugin. Drag and drop of table rows is a special case (jQuery UI doesn’t seem to support it)—this plugin works pretty well though. # 4th July 2008, 12:04 pm

When Bugs Collide: Fixing Text Dimming in Firefox 2. Handy tips from Drew on fixing the glitchy text rendering in Firefox 2 when you animate opacity without breaking alpha-transparent PNGs in IE6. # 19th June 2008, 6:09 pm

Deep Profiling jQuery Apps. Neat plugin from John Resig that monkey-patches most (all?) of the jQuery methods to build up a detailed profile of which methods are being used by a given page. # 16th June 2008, 10:20 am

Updated jQuery Bookmarklet. Nicer than my own “Inject jQuery” bookmarklet because it drops in a temporary message confirming that jQuery has been imported (or telling you that jQuery was already present). # 8th June 2008, 8:46 pm

Google AJAX Libraries API (via) Google are hosting copies of jQuery, Prototype, mooTools and Dojo on their CDN, with a promise to permanently host different versions and an optional JavaScript API to dynamically load the most recent version of a library. I wish they’d stop capitalising Ajax though. # 27th May 2008, 5:56 pm

QUnit. The jQuery unit testing framework is now documented and supported as a separate project. # 26th May 2008, 5:31 pm

Cubescape. Beautiful isometric cube building tool by Cameron Adams, written in JavaScript and jQuery. # 15th May 2008, 8:40 am

Doctype: /trunk/goog. Google’s newly released JavaScript library (pure JavaScript, so more along the lines of YUI and jQuery than GWT). I haven’t found the documentation for it yet, but the code is extremely well commented. UPDATE: The documentation is spread throughout Doctype. # 14th May 2008, 9:12 pm

Unobtrusive JavaScript with jQuery. The online handout for the tutorial I gave this morning at XTech. # 6th May 2008, 6:53 pm

jQuery style chaining with the Django ORM

Django’s ORM is, in my opinion, the unsung gem of the framework. For the subset of SQL that’s used in most web applications it’s very hard to beat. It’s a beautiful piece of API design, and I tip my hat to the people who designed and built it.

[... 820 words]

Classy Query. Beautifully implemented parody of class-based JavaScript and verbose namespacing as a jQuery extension, from John Resig. The source code has some neat tricks in it, in particular the buildClass() function. # 1st April 2008, 9:48 am

“Why doesn’t jQuery have an XPath CSS Selector implementation?” For now, my answer is: I don’t want two selector implementations—it makes the code base significantly harder to maintain, increases the number of possible cross-browser bugs, and drastically increases the filesize of the resulting download.

John Resig # 11th February 2008, 5:31 am

jQuery 1.2 Cheat Sheet. Handy. It helps that most of jQuery’s method names are pretty much self explanatory once you’ve been using the library for a couple of weeks. # 10th February 2008, 9:12 pm

Event Delegation Made Easy. Dan Webb demonstrates a neat trick for event delegation in jQuery, using CSS selectors and the jQuery .is() method to dispatch to different callbacks from a single event handler based on the target of the event. # 10th February 2008, 3:13 pm

Low Pro For jQuery? Dan Webb on why he prefers Prototype over jQuery: “The one big reason was that, while jQuery was super simple and concise when working on smaller projects, it offered no help in structuring larger applications”. # 3rd February 2008, 10:16 pm

jQuery.ScrollTo (via) Neat jQuery plugin for animated scrolling of both windows and overflow elements. # 21st January 2008, 9:53 pm

.first() and .last() methods for jQuery. I got fed up of expecting these to exist, so I wrote them as a couple of one-liner plugins. # 16th January 2008, 9:41 pm

jQuery 1.2.2: 2nd Birthday Present. The API stays the same, but there are some healthy speed improvements, a new way of adding custom events and (most importantly) .ready() now waits for the CSS to be ready in addition to the DOM. # 15th January 2008, 8:59 am