diff options
| author | Misko Hevery | 2011-11-07 21:54:01 -0800 |
|---|---|---|
| committer | Misko Hevery | 2011-11-14 20:31:14 -0800 |
| commit | 78c7066422a9c800e7d527a4ed588a138a326551 (patch) | |
| tree | 2965246a680bb68fda97496fdd9f6161631e9e73 /src/Angular.js | |
| parent | 923da410bd57481be67d3d5039245929498e94ac (diff) | |
| download | angular.js-78c7066422a9c800e7d527a4ed588a138a326551.tar.bz2 | |
refactor(angular): isDate / isArray test iframe independent fix
Diffstat (limited to 'src/Angular.js')
| -rw-r--r-- | src/Angular.js | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/src/Angular.js b/src/Angular.js index 0dfea2f4..72a892e5 100644 --- a/src/Angular.js +++ b/src/Angular.js @@ -80,7 +80,6 @@ var _undefined = undefined, $name = 'name', $noop = 'noop', $null = 'null', - $number = 'number', $object = 'object', $string = 'string', $value = 'value', @@ -94,6 +93,7 @@ var _undefined = undefined, jQuery, // delay binding slice = [].slice, push = [].push, + toString = Object.prototype.toString, error = window[$console] ? bind(window[$console], window[$console]['error'] || noop) : noop, @@ -363,7 +363,7 @@ function isString(value){return typeof value == $string;} * @param {*} value Reference to check. * @returns {boolean} True if `value` is a `Number`. */ -function isNumber(value){return typeof value == $number;} +function isNumber(value){return typeof value == 'number';} /** @@ -377,7 +377,9 @@ function isNumber(value){return typeof value == $number;} * @param {*} value Reference to check. * @returns {boolean} True if `value` is a `Date`. */ -function isDate(value){return value instanceof Date;} +function isDate(value){ + return toString.apply(value) == '[object Date]'; +} /** @@ -391,7 +393,9 @@ function isDate(value){return value instanceof Date;} * @param {*} value Reference to check. * @returns {boolean} True if `value` is an `Array`. */ -function isArray(value) {return value instanceof Array;} +function isArray(value) { + return toString.apply(value) == '[object Array]'; +} /** @@ -769,7 +773,7 @@ function equals(o1, o2) { if (o1 === null || o2 === null) return false; var t1 = typeof o1, t2 = typeof o2, length, key, keySet; if (t1 == t2 && t1 == 'object') { - if (o1 instanceof Array) { + if (isArray(o1)) { if ((length = o1.length) == o2.length) { for(key=0; key<length; key++) { if (!equals(o1[key], o2[key])) return false; |
