Keep the Util.alphaHack function result in a cache. r=pgiraud (closes #1825)

git-svn-id: http://svn.openlayers.org/trunk/openlayers@8419 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
Frédéric Junod
2008-11-27 14:23:11 +00:00
parent b694095a89
commit 274afe0a5f

View File

@@ -390,6 +390,12 @@ OpenLayers.Util.onImageLoadError = function() {
this.style.display = ""; this.style.display = "";
}; };
/**
* Property: alphaHackNeeded
* {Boolean} true if the png alpha hack is necessary and possible, false otherwise.
*/
OpenLayers.Util.alphaHackNeeded = null;
/** /**
* Function: alphaHack * Function: alphaHack
* Checks whether it's necessary (and possible) to use the png alpha * Checks whether it's necessary (and possible) to use the png alpha
@@ -397,9 +403,10 @@ OpenLayers.Util.onImageLoadError = function() {
* Explorer. * Explorer.
* *
* Returns: * Returns:
* {Boolean} true if alpha has is necessary and possible, false otherwise. * {Boolean} true if the png alpha hack is necessary and possible, false otherwise.
*/ */
OpenLayers.Util.alphaHack = function() { OpenLayers.Util.alphaHack = function() {
if (OpenLayers.Util.alphaHackNeeded == null) {
var arVersion = navigator.appVersion.split("MSIE"); var arVersion = navigator.appVersion.split("MSIE");
var version = parseFloat(arVersion[1]); var version = parseFloat(arVersion[1]);
var filter = false; var filter = false;
@@ -411,11 +418,12 @@ OpenLayers.Util.alphaHack = function() {
try { try {
filter = !!(document.body.filters); filter = !!(document.body.filters);
} catch (e) { } catch (e) {}
}
return ( filter && OpenLayers.Util.alphaHackNeeded = (filter &&
(version >= 5.5) && (version < 7)); (version >= 5.5) && (version < 7));
}
return OpenLayers.Util.alphaHackNeeded;
}; };
/** /**