July 19th, 2008
The offset method in jQuery is a bit slow … okay … really slow. :) I’ve been working on a new version of the offset method from the ground up largely focusing on performance. I’ve made some good progress and just had to share the results thus far!
The test case is simple. I have a div within a div and both divs have margin, border, padding. I first run the original offset method from jQuery 1.2.6 200 times. Then I run my new version 200 times. The original offset method took 260.823ms to run and the new offset method only took 56.222ms! Not to mention that as it stands right now I’ve cut the code in half from over 90 lines to just over 40 lines. Here is a screen grab of the Firebug profiler.

I can’t wait to get this method finished up and into the core!
May 9th, 2008
The Dimensions plugin was originally started by Paul Bakaus. By popular demand my offset plugin was merged with the Dimensions plugin. From that point on I contributed several other methods to Dimensions and helped maintain the plugin with Paul. Dimensions became one of the most widely depended on plugins by developers and other plugins. It was a very common request to have Dimensions moved into the core to help relieve plugin dependency issues. We started by moving the most popular methods into the core but that wasn’t enough. The plugin was still a very common dependency. As of SVN Revision 5345 the Dimensions plugin has been merged into the jQuery core. You can find the documentation for the current Dimensions plugin on the jQuery documentation wiki.
May 9th, 2008
I've been asked a few times if Dimensions would provide a method for getting the scrollbar width. In Dimensions 1.0 I created an internal method for finding the scrollbar width to hack around some browser limitations. I eventually found other ways around those limitations and that code is no longer in Dimensions. I know that in some unusual cases it can be useful, so I want to go ahead and provide that code as one of my jQuery snippets. It is just a single method added to the jQuery namespace called getScrollbarWidth.
Here is an example of it and here is the small script.
May 8th, 2008
jQuery methods, in most cases, operate on zero or more matched elements. Getter type methods are an exception. The getter methods only return the results for the first matched element. This is overwhelmingly the typical use-case. However, sometimes you might want to get the results for all matched elements in the jQuery collection. Introducing jQuery.batch, a small extension to jQuery that adds such functionality.
Read the rest of this entry »
August 19th, 2007
Live Query, previously called Behavior, utilizes the power of jQuery selectors by binding events or firing callbacks for matched elements auto-magically, even after the page has been loaded and the DOM updated.
For example you could use the following code to bind a click event to all A tags, even any A tags you might add via AJAX or a script.
Read the rest of this entry »
August 17th, 2007
Release early, release often. In the 1.1.1 update there was a regression in Safari with calculating the window width and height. I also fixed a bug in getting the offset of table cells with borders in Mozilla. As usual, you can report bugs, request features and download Dimensions 1.1.2 from the Dimensions project page.
August 17th, 2007
I just released Dimensions 1.1.1 which fixes up an issue when trying to get the document width and height. Grab the zip from the Dimensions project page.
August 12th, 2007
I just released Dimensions 1.1. It includes a new option to include margins for the outerWidth and outerHeight methods. I've also fixed the issues with Safari 3 and the offset method. This update does require jQuery 1.1.3 or greater. Feel free to grab the zip from the Dimensions project page. Oh and the docs have been updated for 1.1.
July 25th, 2007
I just released Dimensions 1.0.1. It fixes an issue with fixed position elements in Opera and makes it easier to run the test suite locally.
You can download the zip from the Dimensions project page.
July 22nd, 2007
Dimensions 1.0 is final! This is a very big release for Dimensions and includes a lot of bug fixes, new features, an automated test suite and docs. Yup, even docs! So what new features have been added to Dimensions in 1.0?
Read the rest of this entry »