Jim Ing’s Line Noise

Rants and raves on (mostly) technology

I’m using script.aculo.us 1.7.1 beta 3 with prototype 1.5.1.1, and I’ve found a bug when I use draggables in Internet Explorer. If I modify the DOM tree and then try to drag an object, I get an “Unspecified Error” at line 3088 (in prototype.js version 1.5.1.1).

This works fine on other browsers like Firefox and Opera. I think the problem is that IE doesn’t return null.

After searching for a solution, I came across this post (http://forums.asp.net/p/1038609/1444564.aspx) which suggests wrapping the offsetParent code in a trycatch block. So I tried it and my code now works in IE. Woohoo!!!

  cumulativeOffset: function(element) {
    var valueT = 0, valueL = 0;
    try {
        do {
          valueT += element.offsetTop  || 0;
          valueL += element.offsetLeft || 0;
          element = element.offsetParent;
        } while (element);
    }
    catch( ex ) {
    }
    return [valueL, valueT];
  },

I’m not sure if this is the best solution, but it seems like the simplest. :)

  • 0 Comments
  • Filed under: JavaScript
  • Car

    Here’s a fix to allow PNG transparencies in IE 5.5 and 6. This is a CSS-based solution so it doesn’t conflict with JavaScript like some other solutions.
    http://www.twinhelix.com/css/iepngfix/

    This page has a better explanation of how to use it:
    http://bjorkoy.com/past/2007/4/8/the_easiest_way_to_png/

    Also, here’s a good test page, but I don’t recommend their JavaScript solution:
    http://homepage.ntlworld.com/bobosola/pngtest.htm

    For info from Microsoft on this problem, see this page:
    http://support.microsoft.com/kb/294714

  • 0 Comments
  • Filed under: Web
  • Pages

      open all | close all

    Categories

      open all | close all



    Recent Comments

    Tag Cloud



    Blogroll


    Archives

      open all | close all


    Meta



    Spreadfirefox Affiliate Button

    www.spreadthunderbird.com


    free counters