Element.setOpacity now calls removeAttribute on the filter style on IE if no more filters remain, which makes Cleartype work properly. Closes #8376.

This commit is contained in:
Thomas Fuchs 2007-05-19 00:11:46 +00:00
parent 55b658ac57
commit f099e670f5
3 changed files with 9 additions and 2 deletions

View File

@ -1,5 +1,7 @@
*SVN*
* Element.setOpacity now calls removeAttribute on the filter style on IE if no more filters remain, which makes Cleartype work properly. Closes #8376. [alexdemi, Thomas Fuchs]
* Event.findElement now uses Element#up (and as a result can take a CSS selector instead of just a tag name). [Tobie Langel]
* Minor cleanup of the position methods [sam]

View File

@ -689,13 +689,17 @@ else if (Prototype.Browser.IE) {
};
Element.Methods.setOpacity = function(element, value) {
function stripAlpha(filter){
return filter.replace(/alpha\([^\)]*\)/gi,'');
}
element = $(element);
var filter = element.getStyle('filter'), style = element.style;
if (value == 1 || value === '') {
style.filter = filter.replace(/alpha\([^\)]*\)/gi,'');
(filter = stripAlpha(filter)) ?
style.filter = filter : style.removeAttribute('filter');
return element;
} else if (value < 0.00001) value = 0;
style.filter = filter.replace(/alpha\([^\)]*\)/gi, '') +
style.filter = stripAlpha(filter) +
'alpha(opacity=' + (value * 100) + ')';
return element;
};

View File

@ -894,6 +894,7 @@
assert(
$('style_test_3').setOpacity(0.9999999).getStyle('opacity') > 0.999
);
}},
testElementGetStyle: function() { with(this) {