Removed Prefix from method names, since now it's part of the module name

This commit is contained in:
Gregers Gram Rygg
2012-06-27 13:33:47 +02:00
parent 7f32342ec3
commit 1ba6aa75d7
4 changed files with 21 additions and 21 deletions

View File

@@ -20,7 +20,7 @@ OpenLayers.Animation = (function(window) {
* Property: isNative
* {Boolean} true if a native requestAnimationFrame function is available
*/
var requestAnimationFrame = OpenLayers.Util.vendorPrefix.jsPrefix(window, "requestAnimationFrame");
var requestAnimationFrame = OpenLayers.Util.vendorPrefix.js(window, "requestAnimationFrame");
var isNative = !!(requestAnimationFrame);
/**

View File

@@ -163,7 +163,7 @@ OpenLayers.Control.PinchZoom = OpenLayers.Class(OpenLayers.Control, {
*/
applyTransform: function(transform) {
var style = this.map.layerContainerDiv.style;
var transformProperty = OpenLayers.Util.vendorPrefix.stylePrefix("transform");
var transformProperty = OpenLayers.Util.vendorPrefix.style("transform");
if (transformProperty) {
style[transformProperty] = transform;
}

View File

@@ -41,7 +41,7 @@ OpenLayers.Util.vendorPrefix = (function() {
}
/**
* APIMethod: cssPrefix
* APIMethod: css
* Detect which property is used for a CSS property
*
* Parameters:
@@ -51,18 +51,18 @@ OpenLayers.Util.vendorPrefix = (function() {
* {String} The standard CSS property, prefixed property or null if not
* supported
*/
function cssPrefix(property) {
function css(property) {
if (cssCache[property] === undefined) {
var domProperty = property.
replace(/(-[\s\S])/g, function(c) { return c.charAt(1).toUpperCase(); });
var prefixedDom = stylePrefix(domProperty);
var prefixedDom = style(domProperty);
cssCache[property] = domToCss(prefixedDom);
}
return cssCache[property];
}
/**
* APIMethod: jsPrefix
* APIMethod: js
* Detect which property is used for a JS property/method
*
* Parameters:
@@ -73,7 +73,7 @@ OpenLayers.Util.vendorPrefix = (function() {
* {String} The standard JS property, prefixed property or null if not
* supported
*/
function jsPrefix(obj, property) {
function js(obj, property) {
if (jsCache[property] === undefined) {
var tmpProp,
i = 0,
@@ -105,7 +105,7 @@ OpenLayers.Util.vendorPrefix = (function() {
}
/**
* APIMethod: stylePrefix
* APIMethod: style
* Detect which property is used for a DOM style property
*
* Parameters:
@@ -115,14 +115,14 @@ OpenLayers.Util.vendorPrefix = (function() {
* {String} The standard style property, prefixed property or null if not
* supported
*/
function stylePrefix(property) {
return jsPrefix(divStyle, property);
function style(property) {
return js(divStyle, property);
}
return {
cssPrefix: cssPrefix,
jsPrefix: jsPrefix,
stylePrefix: stylePrefix,
css: css,
js: js,
style: style,
// used for testing
cssCache: cssCache,

View File

@@ -44,7 +44,7 @@
function curryTestPrefix(type) {
return function(standardProp, expectedPrefix, msg) {
var prefixedProp, err, method = type + "Prefix";
var prefixedProp, err;
try {
clearCache(type);
var fakeStyle = { cssText: "" };
@@ -52,7 +52,7 @@
fakeStyle[o.prop] = o.val;
}
OpenLayers.Util.vendorPrefix._mockStyle(fakeStyle);
prefixedProp = OpenLayers.Util.vendorPrefix[method](standardProp);
prefixedProp = OpenLayers.Util.vendorPrefix[type](standardProp);
} catch(e) {
err = e;
}
@@ -98,22 +98,22 @@
// test vendor prefix on object
clearCache("js");
t.eq( OpenLayers.Util.vendorPrefix.jsPrefix( {}, "unsupported" ), null, "Standard object property - unsupported");
t.eq( OpenLayers.Util.vendorPrefix.js( {}, "unsupported" ), null, "Standard object property - unsupported");
clearCache("js");
t.eq( OpenLayers.Util.vendorPrefix.jsPrefix( { "test": true }, "test" ), "test", "Standard object property");
t.eq( OpenLayers.Util.vendorPrefix.js( { "test": true }, "test" ), "test", "Standard object property");
clearCache("js");
t.eq( OpenLayers.Util.vendorPrefix.jsPrefix( { "oTest": true }, "test" ), "oTest", "Standard object property");
t.eq( OpenLayers.Util.vendorPrefix.js( { "oTest": true }, "test" ), "oTest", "Standard object property");
clearCache("js");
t.eq( OpenLayers.Util.vendorPrefix.jsPrefix( { "msTest": true }, "test" ), "msTest", "Standard object property");
t.eq( OpenLayers.Util.vendorPrefix.js( { "msTest": true }, "test" ), "msTest", "Standard object property");
clearCache("js");
t.eq( OpenLayers.Util.vendorPrefix.jsPrefix( { "mozTest": true }, "test" ), "mozTest", "Standard object property");
t.eq( OpenLayers.Util.vendorPrefix.js( { "mozTest": true }, "test" ), "mozTest", "Standard object property");
clearCache("js");
t.eq( OpenLayers.Util.vendorPrefix.jsPrefix( { "webkitTest": true }, "test" ), "webkitTest", "Standard object property");
t.eq( OpenLayers.Util.vendorPrefix.js( { "webkitTest": true }, "test" ), "webkitTest", "Standard object property");
// unwrap document.createElement
//document.createElement = orgCreateElement;