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 * Property: isNative
* {Boolean} true if a native requestAnimationFrame function is available * {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); var isNative = !!(requestAnimationFrame);
/** /**

View File

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

View File

@@ -44,7 +44,7 @@
function curryTestPrefix(type) { function curryTestPrefix(type) {
return function(standardProp, expectedPrefix, msg) { return function(standardProp, expectedPrefix, msg) {
var prefixedProp, err, method = type + "Prefix"; var prefixedProp, err;
try { try {
clearCache(type); clearCache(type);
var fakeStyle = { cssText: "" }; var fakeStyle = { cssText: "" };
@@ -52,7 +52,7 @@
fakeStyle[o.prop] = o.val; fakeStyle[o.prop] = o.val;
} }
OpenLayers.Util.vendorPrefix._mockStyle(fakeStyle); OpenLayers.Util.vendorPrefix._mockStyle(fakeStyle);
prefixedProp = OpenLayers.Util.vendorPrefix[method](standardProp); prefixedProp = OpenLayers.Util.vendorPrefix[type](standardProp);
} catch(e) { } catch(e) {
err = e; err = e;
} }
@@ -98,22 +98,22 @@
// test vendor prefix on object // test vendor prefix on object
clearCache("js"); 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"); 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"); 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"); 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"); 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"); 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 // unwrap document.createElement
//document.createElement = orgCreateElement; //document.createElement = orgCreateElement;