summaryrefslogtreecommitdiff
path: root/lib/dojo/_base/lang.js
diff options
context:
space:
mode:
authorAndrew Dolgov <[email protected]>2011-11-08 20:40:44 +0400
committerAndrew Dolgov <[email protected]>2011-11-08 20:40:44 +0400
commit81bea17aefb26859f825b9293c7c99192874806e (patch)
treefb244408ca271affa2899adb634788802c9a89d8 /lib/dojo/_base/lang.js
parent870a70e109ac9e80a88047044530de53d0404ec7 (diff)
upgrade Dojo to 1.6.1
Diffstat (limited to 'lib/dojo/_base/lang.js')
-rw-r--r--lib/dojo/_base/lang.js35
1 files changed, 20 insertions, 15 deletions
diff --git a/lib/dojo/_base/lang.js b/lib/dojo/_base/lang.js
index 0e9c7c2f9..9061de01e 100644
--- a/lib/dojo/_base/lang.js
+++ b/lib/dojo/_base/lang.js
@@ -1,5 +1,5 @@
/*
- Copyright (c) 2004-2010, The Dojo Foundation All Rights Reserved.
+ Copyright (c) 2004-2011, The Dojo Foundation All Rights Reserved.
Available via Academic Free License >= 2.1 OR the modified BSD license.
see: http://dojotoolkit.org/license for details
*/
@@ -9,6 +9,7 @@ if(!dojo._hasResource["dojo._base.lang"]){ //_hasResource checks added by build.
dojo._hasResource["dojo._base.lang"] = true;
dojo.provide("dojo._base.lang");
+
(function(){
var d = dojo, opts = Object.prototype.toString;
@@ -18,14 +19,14 @@ dojo.provide("dojo._base.lang");
// summary:
// Return true if it is a String
return (typeof it == "string" || it instanceof String); // Boolean
- }
+ };
dojo.isArray = function(/*anything*/ it){
// summary:
// Return true if it is an Array.
// Does not work on Arrays created in other windows.
return it && (it instanceof Array || typeof it == "array"); // Boolean
- }
+ };
dojo.isFunction = function(/*anything*/ it){
// summary:
@@ -39,7 +40,7 @@ dojo.provide("dojo._base.lang");
// or null)
return it !== undefined &&
(it === null || typeof it == "object" || d.isArray(it) || d.isFunction(it)); // Boolean
- }
+ };
dojo.isArrayLike = function(/*anything*/ it){
// summary:
@@ -58,14 +59,14 @@ dojo.provide("dojo._base.lang");
!d.isString(it) && !d.isFunction(it) &&
!(it.tagName && it.tagName.toLowerCase() == 'form') &&
(d.isArray(it) || isFinite(it.length));
- }
+ };
dojo.isAlien = function(/*anything*/ it){
// summary:
// Returns true if it is a built-in function or some other kind of
// oddball that *should* report as a function but doesn't
return it && !d.isFunction(it) && /\{\s*\[native code\]\s*\}/.test(String(it)); // Boolean
- }
+ };
dojo.extend = function(/*Object*/ constructor, /*Object...*/ props){
// summary:
@@ -76,7 +77,7 @@ dojo.provide("dojo._base.lang");
d._mixin(constructor.prototype, arguments[i]);
}
return constructor; // Object
- }
+ };
dojo._hitchArgs = function(scope, method /*,...*/){
var pre = d._toArray(arguments, 2);
@@ -88,8 +89,8 @@ dojo.provide("dojo._base.lang");
var f = named ? (scope||d.global)[method] : method;
// invoke with collected args
return f && f.apply(scope || this, pre.concat(args)); // mixed
- } // Function
- }
+ }; // Function
+ };
dojo.hitch = function(/*Object*/scope, /*Function|String*/method /*,...*/){
// summary:
@@ -97,7 +98,7 @@ dojo.provide("dojo._base.lang");
// This allows for easy use of object member functions
// in callbacks and other places in which the "this" keyword may
// otherwise not reference the expected scope.
- // Any number of default positional arguments may be passed as parameters
+ // Any number of default positional arguments may be passed as parameters
// beyond "method".
// Each of these values will be used to "placehold" (similar to curry)
// for the hitched function.
@@ -137,7 +138,7 @@ dojo.provide("dojo._base.lang");
return function(){ return scope[method].apply(scope, arguments || []); }; // Function
}
return !scope ? method : function(){ return method.apply(scope, arguments || []); }; // Function
- }
+ };
/*=====
dojo.delegate = function(obj, props){
@@ -181,7 +182,7 @@ dojo.provide("dojo._base.lang");
d._mixin(tmp, props);
}
return tmp; // Object
- }
+ };
})();
/*=====
@@ -230,7 +231,7 @@ dojo.provide("dojo._base.lang");
// | dojo.hitch(null, funcName, ...);
var arr = [ null ];
return d.hitch.apply(d, arr.concat(d._toArray(arguments))); // Function
- }
+ };
var extraNames = d._extraNames, extraLen = extraNames.length, empty = {};
@@ -250,6 +251,10 @@ dojo.provide("dojo._base.lang");
// Date
return new Date(o.getTime()); // Date
}
+ if(o instanceof RegExp){
+ // RegExp
+ return new RegExp(o); // RegExp
+ }
var r, i, l, s, name;
if(d.isArray(o)){
// array
@@ -288,7 +293,7 @@ dojo.provide("dojo._base.lang");
}
}
return r; // Object
- }
+ };
/*=====
dojo.trim = function(str){
@@ -317,7 +322,7 @@ dojo.provide("dojo._base.lang");
dojo.replace = function(tmpl, map, pattern){
// summary:
// Performs parameterized substitutions on a string. Throws an
- // exception if any parameter is unmatched.
+ // exception if any parameter is unmatched.
// tmpl: String
// String to be used as a template.
// map: Object|Function