fix for #859 - make default return from OpenLayers.Util.Try() explicitly null. Also add tests and documentations

git-svn-id: http://svn.openlayers.org/trunk/openlayers@3816 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
euzuro
2007-07-26 19:20:33 +00:00
parent 8c552be94b
commit b1097e31c0
2 changed files with 45 additions and 1 deletions

View File

@@ -543,10 +543,21 @@ OpenLayers.Util.getImagesLocation = function() {
/**
* Function: Try
* Execute functions until one of them doesn't throw an error.
* Capitalized because "try" is a reserved word in JavaScript.
* Taken directly from OpenLayers.Util.Try()
*
* Parameters:
* [*] - {Function} Any number of parameters may be passed to Try()
* It will attempt to execute each of them until one of them
* successfully executes.
* If none executes successfully, returns null.
*
* Return:
* {*} The value returned by the first successfully executed function.
*/
OpenLayers.Util.Try = function() {
var returnValue;
var returnValue = null;
for (var i = 0; i < arguments.length; i++) {
var lambda = arguments[i];