cleanup setOpacity for IE
This commit is contained in:
parent
3826467f46
commit
3201dd066a
@ -146,6 +146,7 @@ Icon API was improved to be more flexible, but one of the changes is backwards-i
|
||||
* Fixed a bug that could cause false `mousemove` events on click in Chrome (by [@stsydow](https://github.com/stsydow)). [#757](https://github.com/CloudMade/Leaflet/pull/757)
|
||||
* Fixed a bug in IE6-8 where adding fill or stroke on vector layers after initialization with `setStyle` would break the map. [#641](https://github.com/CloudMade/Leaflet/issues/641)
|
||||
* Fixed a bug that broke Leaflet for websites that had XHTML content-type header set (by [lars-sh](https://github.com/lars-sh)). [#801](https://github.com/CloudMade/Leaflet/pull/801)
|
||||
* Fixed a bug with setOpacity in IE where it would not work correctly if used more than once on the same element (by [@ajbeaven](https://github.com/ajbeaven)). [#827](https://github.com/CloudMade/Leaflet/pull/827)
|
||||
|
||||
#### Mobile browser bugfixes
|
||||
|
||||
|
@ -106,29 +106,25 @@ L.DomUtil = {
|
||||
},
|
||||
|
||||
setOpacity: function (el, value) {
|
||||
|
||||
if ('opacity' in el.style) {
|
||||
el.style.opacity = value;
|
||||
|
||||
} else if (L.Browser.ie) {
|
||||
|
||||
var filter = false,
|
||||
prefix = 'DXImageTransform.Microsoft.',
|
||||
filterName = 'Alpha';
|
||||
filterName = 'DXImageTransform.Microsoft.Alpha';
|
||||
|
||||
// filters collection throws an error if we try to retrieve a filter that doesn't exist
|
||||
try { filter = el.filters.item(prefix + filterName); } catch (e) { }
|
||||
if (!filter) try { filter = el.filters.item(filterName); } catch (e) { }
|
||||
try { filter = el.filters.item(filterName); } catch (e) {}
|
||||
|
||||
value = Math.round(value * 100);
|
||||
if (value === 100) {
|
||||
if (filter) {
|
||||
filter.Enabled = false;
|
||||
}
|
||||
|
||||
if (filter) {
|
||||
filter.Enabled = (value === 100);
|
||||
filter.Opacity = value;
|
||||
} else {
|
||||
if (filter) {
|
||||
filter.Enabled = true;
|
||||
filter.Opacity = value;
|
||||
} else {
|
||||
el.style.filter += ' progid:' + prefix + filterName + '(opacity=' + value + ')';
|
||||
}
|
||||
el.style.filter += ' progid:' + filterName + '(opacity=' + value + ')';
|
||||
}
|
||||
}
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user