Archive for June, 2009

Posted by Matt at 11 June 2009

Category: Programming, javascript, jquery, web

This is an old issue, but I never looked into it in enough detail to solve it until now.

When using slideUp() and slideDown() in jQuery (and any other animations that animate height) there is often a “flash of content” when the animation starts or stops in IE.

Here are the details you might want to know:

  1. IE 6/7 mishandles a style like “overflow:hidden;height:0px;” (which should show nothing) and instead show the entire contents of the object. But ONLY in quirks mode. This is a bug.
  2. When doing a hide animation, jQuery animates to 0, and when doing show, it starts at 0
  3. So when the value of 0 is set inside the animation, the entire content is flashed visibly on the screen, this causing annoyance and potential epileptic seizures.

A ticket was filed with jQuery 2 years ago about this issue: http://dev.jquery.com/ticket/1726

Unfortunately, they changed it to “wontfix” and instead declared that FX animations are not supported in IE6/7 in quirksmode. I consider this to be pretty lazy on the part of the developers, and I’ve seen this attitude several times with regards to problems that are not so obviously solved or outlying cases. It’s disappointing.

I started a thread in the jQuery Dev group about this, so we’ll see if anything comes of it.

Meanwhile, inserting this fix into the page solves the problem:

jQuery.fx.prototype.originalCustom = jQuery.fx.prototype.custom;
jQuery.fx.prototype.custom = function(from,to,unit) {
        if (this.prop==’height’) {
                to = to || 1;
                from = from || 1;
        }
        this.originalCustom(from,to,unit);
}

It’s simple – when the to or from value in the animation is 0, and we’re animating ‘height’, then just go to/from 1 instead. Problem solved.

Hope that helps out at some point in the future when your content is flashing and you can’t figure out why…

Posted by Matt at 10 June 2009

Category: browser extensions, web

collections

The Mozilla add-ons site has been re-designed, and we finally get the ability to group add-ons together into Collections, which can be installed all at once. Share all your add-ons with others, or make your own Collection to easily install your tools to new instances of the browser.

Now if they would only add automatic sync with my add-ons and settings.

By the way, if you aren’t using FEBE, you should. I have it back up all my Firefox settings nightly to box.net, so if my computer ever crashes I can quickly and easily get everything back. These days, a ton of my stuff is actually stored in the browser, so losing it is quite a hassle.