Doc updates and lint fixes
Showing
3 changed files
with
4 additions
and
11 deletions
... | @@ -220,7 +220,7 @@ Checks if passed argument is an instance of native PhantomJS' ``WebPage`` object | ... | @@ -220,7 +220,7 @@ Checks if passed argument is an instance of native PhantomJS' ``WebPage`` object |
220 | 220 | ||
221 | Merges two objects recursively. | 221 | Merges two objects recursively. |
222 | 222 | ||
223 | Add opts.keepReferences if cloning of internal objects is not needed. | 223 | Add ``opts.keepReferences`` if cloning of internal objects is not needed. |
224 | 224 | ||
225 | .. index:: DOM | 225 | .. index:: DOM |
226 | 226 | ... | ... |
... | @@ -641,11 +641,7 @@ function mergeObjectsInSlimerjs(origin, add, opts) { | ... | @@ -641,11 +641,7 @@ function mergeObjectsInSlimerjs(origin, add, opts) { |
641 | if (isPlainObject(origin[p])) { | 641 | if (isPlainObject(origin[p])) { |
642 | origin[p] = mergeObjects(origin[p], add[p]); | 642 | origin[p] = mergeObjects(origin[p], add[p]); |
643 | } else { | 643 | } else { |
644 | if (keepReferences) { | 644 | origin[p] = keepReferences ? add[p] : clone(add[p]); |
645 | origin[p] = add[p]; | ||
646 | } else { | ||
647 | origin[p] = clone(add[p]); | ||
648 | } | ||
649 | } | 645 | } |
650 | } else { | 646 | } else { |
651 | origin[p] = add[p]; | 647 | origin[p] = add[p]; |
... | @@ -680,11 +676,7 @@ function mergeObjects(origin, add, opts) { | ... | @@ -680,11 +676,7 @@ function mergeObjects(origin, add, opts) { |
680 | if (origin[p] && origin[p].constructor === Object) { | 676 | if (origin[p] && origin[p].constructor === Object) { |
681 | origin[p] = mergeObjects(origin[p], add[p]); | 677 | origin[p] = mergeObjects(origin[p], add[p]); |
682 | } else { | 678 | } else { |
683 | if (keepReferences) { | 679 | origin[p] = keepReferences ? add[p] : clone(add[p]); |
684 | origin[p] = add[p]; | ||
685 | } else { | ||
686 | origin[p] = clone(add[p]); | ||
687 | } | ||
688 | } | 680 | } |
689 | } else { | 681 | } else { |
690 | origin[p] = add[p]; | 682 | origin[p] = add[p]; | ... | ... |
... | @@ -327,6 +327,7 @@ casper.test.begin('isJsFile() tests', 5, function(test) { | ... | @@ -327,6 +327,7 @@ casper.test.begin('isJsFile() tests', 5, function(test) { |
327 | 327 | ||
328 | 328 | ||
329 | casper.test.begin('mergeObjects() tests', 10, function(test) { | 329 | casper.test.begin('mergeObjects() tests', 10, function(test) { |
330 | /* jshint eqeqeq:false */ | ||
330 | var testCases = [ | 331 | var testCases = [ |
331 | { | 332 | { |
332 | obj1: {a: 1}, obj2: {b: 2}, merged: {a: 1, b: 2} | 333 | obj1: {a: 1}, obj2: {b: 2}, merged: {a: 1, b: 2} | ... | ... |
-
Please register or sign in to post a comment