Skip to content

Calling setOpacity with null does not remove the style #2266

Closed
jpdery opened this Issue Jan 31, 2012 · 5 comments

3 participants

@jpdery
jpdery commented Jan 31, 2012

As demonstrated in :

http://jsfiddle.net/d2XnX/1/

Setting the opacity to null does not remove the opacity style. Arian says it has something to do with the value being parsed with parseFloat.

Thanks

@arian arian was assigned Feb 5, 2012
@arian arian added a commit to arian/mootools-core that referenced this issue Feb 5, 2012
@arian arian Specs for #2266 and rudimentary fix.
Passes: Chrome
Fails: IE8
b3e80ee
@arian
MooTools member
arian commented Feb 5, 2012

@ibolmo any ideas?

@arian
MooTools member
arian commented Feb 5, 2012

or @cpojer

@ibolmo
MooTools member
ibolmo commented Feb 5, 2012

Ideas of?

@arian
MooTools member
arian commented Feb 5, 2012

this test fails: arian@b3e80ee#L1R44

The idea is: create an element where CSS is applied by a CSS class. So getStyle('opacity') should return 0.5 if the filter has alpha(opacity=50).

However when you set the opacity to 1, and then set it to null, it should return 0.5 again, but it doesn't.
As far as I can see, if element.style.filter was set once, it isn't removed, but is set to filter: ; zoom: 1, so it doesn't fall back to the defined CSS.

@arian
MooTools member
arian commented Feb 5, 2012

ah, we should be using element.style.removeAttribute('filter'); when the filter property is empty.

@ibolmo ibolmo closed this in adb02e6 Feb 7, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.