diff --git a/src/Angular.js b/src/Angular.js index 7a1830e2333f..c815837380d7 100644 --- a/src/Angular.js +++ b/src/Angular.js @@ -360,8 +360,10 @@ function baseExtend(dst, objs, deep) { dst[key] = new Date(src.valueOf()); } else if (isRegExp(src)) { dst[key] = new RegExp(src); + } else if (src.nodeName) { + dst[key] = src.cloneNode(true); } else if (isElement(src)) { - dst[key] = src[0] ? jqLite(src).clone()[0] : jqLite(src).clone(); + dst[key] = jqLite(src).clone(); } else { if (!isObject(dst[key])) dst[key] = isArray(src) ? [] : {}; baseExtend(dst[key], [src], true); diff --git a/test/AngularSpec.js b/test/AngularSpec.js index 3276f93398f7..8bdd9539ae1d 100644 --- a/test/AngularSpec.js +++ b/test/AngularSpec.js @@ -636,7 +636,9 @@ describe('angular', function() { expect(dst.jqObject).not.toBe(src.jqObject); expect(isElement(dst.element)).toBeTruthy(); + expect(jqLite(dst.element)).not.toBe(dst.element); // i.e it is a DOM element expect(isElement(dst.jqObject)).toBeTruthy(); + expect(jqLite(dst.jqObject)).toBe(dst.jqObject); // i.e it is a jqLite/jquery object }); });