Don't clobber existing prototypes. Since OpenLayers doesn't use 'foo.bind'

anymore, preferring OpenLayers.Function.bind(function, object), we don't
need to provide this -- so if someone provides something different, don't 
clobber it. (Closes #962)


git-svn-id: http://svn.openlayers.org/trunk/openlayers@4339 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
crschmidt
2007-09-16 17:15:54 +00:00
parent 48ceca88a5
commit d75f7430af
+14 -2
View File
@@ -83,6 +83,7 @@ OpenLayers.String = {
} }
}; };
if (!String.prototype.startsWith) {
/** /**
* APIMethod: String.startsWith * APIMethod: String.startsWith
* Deprecated. Whether or not a string starts with another string. * Deprecated. Whether or not a string starts with another string.
@@ -100,7 +101,9 @@ String.prototype.startsWith = function(sStart) {
); );
return OpenLayers.String.startsWith(this, sStart); return OpenLayers.String.startsWith(this, sStart);
}; };
}
if (!String.prototype.contains) {
/** /**
* APIMethod: String.contains * APIMethod: String.contains
* Deprecated. Whether or not a string contains another string. * Deprecated. Whether or not a string contains another string.
@@ -118,7 +121,9 @@ String.prototype.contains = function(str) {
); );
return OpenLayers.String.contains(this, str); return OpenLayers.String.contains(this, str);
}; };
}
if (!String.prototype.trim) {
/** /**
* APIMethod: String.trim * APIMethod: String.trim
* Deprecated. Removes leading and trailing whitespace characters from a string. * Deprecated. Removes leading and trailing whitespace characters from a string.
@@ -134,7 +139,9 @@ String.prototype.trim = function() {
); );
return OpenLayers.String.trim(this); return OpenLayers.String.trim(this);
}; };
}
if (!String.prototype.camelize) {
/** /**
* APIMethod: camelize * APIMethod: camelize
* Deprecated. Camel-case a hyphenated string. * Deprecated. Camel-case a hyphenated string.
@@ -151,7 +158,7 @@ String.prototype.camelize = function() {
); );
return OpenLayers.String.camelize(this); return OpenLayers.String.camelize(this);
}; };
}
/********************* /*********************
* * * *
@@ -183,6 +190,7 @@ OpenLayers.Number = {
} }
}; };
if (!Number.prototype.limitSigDigs) {
/** /**
* APIMethod: Number.limitSigDigs * APIMethod: Number.limitSigDigs
* Deprecated. Limit the number of significant digits on an integer. Does *not* * Deprecated. Limit the number of significant digits on an integer. Does *not*
@@ -202,7 +210,7 @@ Number.prototype.limitSigDigs = function(sig) {
); );
return OpenLayers.Number.limitSigDigs(this, sig); return OpenLayers.Number.limitSigDigs(this, sig);
}; };
}
/********************* /*********************
* * * *
@@ -255,6 +263,7 @@ OpenLayers.Function = {
} }
}; };
if (!Function.prototype.bind) {
/** /**
* APIMethod: Function.bind * APIMethod: Function.bind
* Deprecated. Bind a function to an object. * Deprecated. Bind a function to an object.
@@ -276,7 +285,9 @@ Function.prototype.bind = function() {
Array.prototype.unshift.apply(arguments, [this]); Array.prototype.unshift.apply(arguments, [this]);
return OpenLayers.Function.bind.apply(null, arguments); return OpenLayers.Function.bind.apply(null, arguments);
}; };
}
if (!Function.prototype.bindAsEventListener) {
/** /**
* APIMethod: Function.bindAsEventListener * APIMethod: Function.bindAsEventListener
* Deprecated. Bind a function to an object, and configure it to receive the * Deprecated. Bind a function to an object, and configure it to receive the
@@ -295,3 +306,4 @@ Function.prototype.bindAsEventListener = function(object) {
); );
return OpenLayers.Function.bindAsEventListener(this, object); return OpenLayers.Function.bindAsEventListener(this, object);
}; };
}