Prototype setStyle not working in IE6

I'm using prototype and setStyle in IE6 is just messing everything up. It's throwing a big error.

I've Googled it but cant find a solution.

I've identified the line in prototype with the IE script debugger, it's the final else block:

setStyle: function(element, styles) {
    element = $(element);
    var elementStyle = element.style, match;
    if (Object.isString(styles)) {
      element.style.cssText += ';' + styles;
      return styles.include('opacity') ?
        element.setOpacity(styles.match(/opacity:\s*(\d?\.?\d*)/)[1]) : element;
    }
    for (var property in styles)
      if (property == 'opacity') element.setOpacity(styles[property]);
      else
        elementStyle[(property == 'float' || property == 'cssFloat') ?
          (Object.isUndefined(elementStyle.styleFloat) ? 'cssFloat' : 'styleFloat') :
            property] = styles[property];

    return element;
  },

Anyone had this problem?

P.S. normally I would use jQuery however this is someone else code I've had to update.

Answers


I just ran into this problem myself... if you are using the IE debugger, find the option to show the stack and back up until you get into your own code. The likely culprit is a bogus style setting. In my case I had a copy/paste problem and was attempting to do this:

msgDiv.setStyle( { padding: '6px', margin: 'margin' } );

this line

msgDiv.setStyle( { padding: '6px', margin: '4px' } );

worked perfectly...


Need Your Help

Why subnet mask for IP 10.0.1.4 is 255.255.255.0?

networking

Well I'm not sure whether I'm missing something here. But all I've read is that if first octet of IP is within 0 - 127 then it is categorized as Class A subnet and correspondingly Subnet Mask for ...

Android State Machine

class android-intent android-activity android

I write an Android application.I have a lot of Activities in my application with a large number of transitions between Activities. I decided to realize a state mashine, which will switch my activit...