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:
@@ -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];
|
||||
|
||||
Reference in New Issue
Block a user