diff options
| -rw-r--r-- | src/Angular.js | 11 | ||||
| -rw-r--r-- | src/jqLite.js | 2 |
2 files changed, 12 insertions, 1 deletions
diff --git a/src/Angular.js b/src/Angular.js index 8ada7be6..060e08c1 100644 --- a/src/Angular.js +++ b/src/Angular.js @@ -400,6 +400,17 @@ function isArray(value) { return value instanceof Array; } function isFunction(value){ return typeof value == $function;} +/** + * Checks if `obj` is a window object. + * + * @private + * @param {*} obj Object to check + * @returns {boolean} True if `obj` is a window obj. + */ +function isWindow(obj) { + return obj && obj.document && obj.location && obj.alert && obj.setInterval; +} + function isBoolean(value) { return typeof value == $boolean;} function isTextNode(node) { return nodeName_(node) == '#text'; } function trim(value) { return isString(value) ? value.replace(/^\s*/, '').replace(/\s*$/, '') : value; } diff --git a/src/jqLite.js b/src/jqLite.js index 0f6bed2d..cbba69ad 100644 --- a/src/jqLite.js +++ b/src/jqLite.js @@ -47,7 +47,7 @@ function getStyle(element) { } function JQLite(element) { - if (!isElement(element) && isDefined(element.length) && element.item) { + if (!isElement(element) && isDefined(element.length) && element.item && !isWindow(element)) { for(var i=0; i < element.length; i++) { this[i] = element[i]; } |
