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

Commit

Permalink
perf(merge): remove unnecessary wrapping of jqLite element
Browse files Browse the repository at this point in the history
  • Loading branch information
gkalpak committed Nov 3, 2015
1 parent fe11265 commit 4daafd3
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/Angular.js
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,7 @@ function baseExtend(dst, objs, deep) {
} else if (src.nodeName) {
dst[key] = src.cloneNode(true);
} else if (isElement(src)) {
dst[key] = jqLite(src).clone();
dst[key] = src.clone();
} else {
if (!isObject(dst[key])) dst[key] = isArray(src) ? [] : {};
baseExtend(dst[key], [src], true);
Expand Down
8 changes: 5 additions & 3 deletions test/AngularSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -639,8 +639,10 @@ describe('angular', function() {


it('should copy(clone) elements', function() {
var src = { element: document.createElement('div'),
jqObject: jqLite("<p><span>s1</span><span>s2</span></p>").find("span") };
var src = {
element: document.createElement('div'),
jqObject: jqLite('<p><span>s1</span><span>s2</span></p>').find('span')
};
var dst = {};

merge(dst, src);
Expand All @@ -651,7 +653,7 @@ describe('angular', function() {
expect(isElement(dst.element)).toBeTruthy();
expect(dst.element.nodeName).toBeDefined(); // i.e it is a DOM element
expect(isElement(dst.jqObject)).toBeTruthy();
expect(dst.jqObject.nodeName).toBeUndefined(dst.jqObject); // i.e it is a jqLite/jquery object
expect(dst.jqObject.nodeName).toBeUndefined(); // i.e it is a jqLite/jQuery object
});
});

Expand Down

0 comments on commit 4daafd3

Please sign in to comment.