Skip to content
This repository has been archived by the owner on Apr 12, 2024. It is now read-only.

Commit

Permalink
fix(merge): ensure that jqlite->jqlite and DOM->DOM
Browse files Browse the repository at this point in the history
Previously we were wrapping DOM elements into jqlite objects when cloning
and vice versa.

Fixes #12286 (comment)
  • Loading branch information
petebacondarwin committed Nov 2, 2015
1 parent 838cf4b commit 2f8db1b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/Angular.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 2 additions & 0 deletions test/AngularSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
});
});

Expand Down

0 comments on commit 2f8db1b

Please sign in to comment.