Properly cache the css transform support result
This commit is contained in:
@@ -26,15 +26,15 @@ ol.dom.BrowserFeature = {
|
||||
* http://caniuse.com/#feat=transforms2d
|
||||
* @return {boolean}
|
||||
*/
|
||||
ol.dom.canUseCssTransform = function() {
|
||||
goog.asserts.assert(!goog.isNull(document.body));
|
||||
ol.dom.canUseCssTransform = (function() {
|
||||
var canUseCssTransform;
|
||||
return function() {
|
||||
if (!goog.isDef(canUseCssTransform)) {
|
||||
canUseCssTransform = (function() {
|
||||
goog.asserts.assert(!goog.isNull(document.body));
|
||||
if (!goog.global.getComputedStyle) {
|
||||
// this browser is ancient
|
||||
return false;
|
||||
}
|
||||
canUseCssTransform = false;
|
||||
} else {
|
||||
var el = goog.dom.createElement(goog.dom.TagName.P),
|
||||
has2d,
|
||||
transforms = {
|
||||
@@ -54,12 +54,13 @@ ol.dom.canUseCssTransform = function() {
|
||||
}
|
||||
goog.dom.removeNode(el);
|
||||
|
||||
return (goog.isDefAndNotNull(has2d) && has2d.length > 0 &&
|
||||
canUseCssTransform = (goog.isDefAndNotNull(has2d) && has2d.length > 0 &&
|
||||
has2d !== 'none');
|
||||
}());
|
||||
}
|
||||
}
|
||||
return canUseCssTransform;
|
||||
};
|
||||
};
|
||||
}());
|
||||
|
||||
|
||||
/**
|
||||
@@ -68,15 +69,15 @@ ol.dom.canUseCssTransform = function() {
|
||||
* http://caniuse.com/#feat=transforms3d
|
||||
* @return {boolean}
|
||||
*/
|
||||
ol.dom.canUseCssTransform3D = function() {
|
||||
goog.asserts.assert(!goog.isNull(document.body));
|
||||
ol.dom.canUseCssTransform3D = (function() {
|
||||
var canUseCssTransform3D;
|
||||
return function() {
|
||||
if (!goog.isDef(canUseCssTransform3D)) {
|
||||
canUseCssTransform3D = (function() {
|
||||
goog.asserts.assert(!goog.isNull(document.body));
|
||||
if (!goog.global.getComputedStyle) {
|
||||
// this browser is ancient
|
||||
return false;
|
||||
}
|
||||
canUseCssTransform3D = false;
|
||||
} else {
|
||||
var el = goog.dom.createElement(goog.dom.TagName.P),
|
||||
has3d,
|
||||
transforms = {
|
||||
@@ -96,12 +97,13 @@ ol.dom.canUseCssTransform3D = function() {
|
||||
}
|
||||
goog.dom.removeNode(el);
|
||||
|
||||
return (goog.isDefAndNotNull(has3d) && has3d.length > 0 &&
|
||||
has3d !== 'none');
|
||||
}());
|
||||
canUseCssTransform3D = (goog.isDefAndNotNull(has3d) &&
|
||||
has3d.length > 0 && has3d !== 'none');
|
||||
}
|
||||
}
|
||||
return canUseCssTransform3D;
|
||||
};
|
||||
};
|
||||
}());
|
||||
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user