#756 ✓duplicate
tim

IE Invalid Property Value Exception when assigning backgroundColor property via element.style

Reported by tim | August 3rd, 2009 @ 11:50 PM | in 1.7

I get an "Invalid property value" exception everytime I attempt to hover out of an Ajax.EditInPlace control. The exception comes from L 1915 in prototype.js. It appears as if a calculation somewhere else is causing this error to be thrown in IE only. I notice that when attempting to assign the backgroundColor property the value has NaN in what is supposed to be a hex string. I am assuming the problem is wherever this string is calculated not the setStyle method itself.

Sorry I don't have more time to trace. Let me know if you also experience this behavior. I'd be happy to help investigate the cause more if you guys feel it's a pertinent bug. I just added a quick patch so I can go on about my business for now. I know it's terrible. Feel free to blast me :)

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]);
    }

    //CHANGED CODE *************************
    else if (Prototype.Browser.IE && property == 'backgroundColor') {
        try{
            elementStyle[property] = styles[property];                                      
        }
        catch(err){null}
    }
    //******************************

else{
  elementStyle[(property == 'float' || property == 'cssFloat') ?
    (Object.isUndefined(elementStyle.styleFloat) ? 'cssFloat' : 'styleFloat') :
      property] = styles[property]; 
    }

return element; },

Comments and changes to this ticket

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป

The Prototype JavaScript library.

Shared Ticket Bins

People watching this ticket

Pages