diff options
| author | Tobias Bosch | 2013-12-18 18:51:56 -0800 | 
|---|---|---|
| committer | Tobias Bosch | 2013-12-18 21:44:00 -0800 | 
| commit | 274a6734ef1fff543cc50388a0958d1988baeb57 (patch) | |
| tree | fcf0b5d9646e6406c3cbb306be693cae590d13a2 /src/Angular.js | |
| parent | f0e3dfd008b1fa5550298aba7f913d6ce0395bde (diff) | |
| download | angular.js-274a6734ef1fff543cc50388a0958d1988baeb57.tar.bz2 | |
fix(forEach): allow looping over result of querySelectorAll in IE8
In IE8 the result object
of calling `node.querySelectorAll` does not have a `hasOwnPropery`
function. However, it should be usable with `forEach`.
Related to #5400.
Diffstat (limited to 'src/Angular.js')
| -rw-r--r-- | src/Angular.js | 4 | 
1 files changed, 3 insertions, 1 deletions
| diff --git a/src/Angular.js b/src/Angular.js index 88ea452b..386682a3 100644 --- a/src/Angular.js +++ b/src/Angular.js @@ -213,7 +213,9 @@ function forEach(obj, iterator, context) {    if (obj) {      if (isFunction(obj)){        for (key in obj) { -        if (key != 'prototype' && key != 'length' && key != 'name' && obj.hasOwnProperty(key)) { +        // Need to check if hasOwnProperty exists, +        // as on IE8 the result of querySelectorAll is an object without a hasOwnProperty function +        if (key != 'prototype' && key != 'length' && key != 'name' && (!obj.hasOwnProperty || obj.hasOwnProperty(key))) {            iterator.call(context, obj[key], key);          }        } | 
