setStyle() negative value and IE7 #2233

Closed
ibolmo opened this Issue Jan 19, 2012 · 4 comments

Projects

None yet

4 participants

@ibolmo
Owner
ibolmo commented Jan 19, 2012

(from Lighthouse)

Some softs developped with mootools calculate the height / margin, etc. of DOM elements and set them through the Element.setStyle() function.

Sometime, the sended value can be negative.
Modern browsers don't care but IE7 fired an error : "Member not found" at line 3566. (test on margin)

The solution could be to replace, in Element.setStyle declaration :

this.style[property] = value;

by

try {
    this.style[property] = value;   
}
catch(e){}

... or to set the nagative margin value to 0...


Example available here :
http://partikule.partikule.net/mootools_setstyle_bug/index.html
This example should be open with IE8 and IE7.

Owner
ibolmo commented Feb 5, 2012

Moving to 1.5 since we can decide to throw an error during a dev environment or do as others and just ignore the call.

bump

Member

I don't at all like the idea that an error in props values is being swallowed. It is useful to get exceptions. Eg case:

element.setStyle('overflow-x', 'none'); // throws in IE

If the above just swallows it, it won't account for behaviour of element failing to change.

The obvious case here is undesired elastic transition loops through negative values which older versions of IE do not accept, for instance, height cannot be negative

Workaround can simply be try/catch block around your animation, not the setter

i'd label this bug as won't fix and close it for now.

Owner
arian commented Sep 3, 2012

agreed with @DimitarChristoff

@arian arian closed this Sep 3, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment