diff options
| author | Pete Bacon Darwin | 2013-05-09 22:15:22 +0100 |
|---|---|---|
| committer | Pete Bacon Darwin | 2013-05-09 22:15:22 +0100 |
| commit | ed4a70e76561b05253424ed2ace659c5eb5dfae1 (patch) | |
| tree | dd64d8d5246a721262ebe1295a4c7f6772bfd883 | |
| parent | 186696831069baf15d1ae7029516309d34082bf6 (diff) | |
| download | angular.js-ed4a70e76561b05253424ed2ace659c5eb5dfae1.tar.bz2 | |
docs(Angular.js): move forEach docs to correct position
| -rw-r--r-- | src/Angular.js | 47 |
1 files changed, 23 insertions, 24 deletions
diff --git a/src/Angular.js b/src/Angular.js index 829743a3..8a14b6aa 100644 --- a/src/Angular.js +++ b/src/Angular.js @@ -61,6 +61,29 @@ var /** holds major version number for IE or NaN for real browsers */ nodeName_, uid = ['0', '0', '0']; + +/** + * @private + * @param {*} obj + * @return {boolean} Returns true if `obj` is an array or array-like object (NodeList, Arguments, ...) + */ +function isArrayLike(obj) { + if (!obj || (typeof obj.length !== 'number')) return false; + + // We have on object which has length property. Should we treat it as array? + if (typeof obj.hasOwnProperty != 'function' && + typeof obj.constructor != 'function') { + // This is here for IE8: it is a bogus object treat it as array; + return true; + } else { + return obj instanceof JQLite || // JQLite + (jQuery && obj instanceof jQuery) || // jQuery + toString.call(obj) !== '[object Object]' || // some browser native object + typeof obj.callee === 'function'; // arguments (on IE8 looks like regular obj) + } +} + + /** * @ngdoc function * @name angular.forEach @@ -88,30 +111,6 @@ var /** holds major version number for IE or NaN for real browsers */ * @param {Object=} context Object to become context (`this`) for the iterator function. * @returns {Object|Array} Reference to `obj`. */ - - -/** - * @private - * @param {*} obj - * @return {boolean} Returns true if `obj` is an array or array-like object (NodeList, Arguments, ...) - */ -function isArrayLike(obj) { - if (!obj || (typeof obj.length !== 'number')) return false; - - // We have on object which has length property. Should we treat it as array? - if (typeof obj.hasOwnProperty != 'function' && - typeof obj.constructor != 'function') { - // This is here for IE8: it is a bogus object treat it as array; - return true; - } else { - return obj instanceof JQLite || // JQLite - (jQuery && obj instanceof jQuery) || // jQuery - toString.call(obj) !== '[object Object]' || // some browser native object - typeof obj.callee === 'function'; // arguments (on IE8 looks like regular obj) - } -} - - function forEach(obj, iterator, context) { var key; if (obj) { |
