mirror of https://github.com/vitalif/phantomjs
parent
74db4807d5
commit
da97b9abbf
|
@ -24,18 +24,19 @@ window.WebPage = function (opts) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function copyInto(target, source) {
|
function copyInto(target, source) {
|
||||||
if (isUndefinedOrNull(target)) {
|
if (target === source || isUndefinedOrNull(source)) {
|
||||||
return (isUndefinedOrNull(source)) ? target : source;
|
return target;
|
||||||
}
|
}
|
||||||
|
|
||||||
var i, newTarget, newSource;
|
target = target || {};
|
||||||
|
|
||||||
// Copy into objects only
|
// Copy into objects only
|
||||||
if (target !== source && isObject(target)) {
|
if (isObject(target)) {
|
||||||
// Make sure source exists
|
// Make sure source exists
|
||||||
source = source || false;
|
source = source || {};
|
||||||
|
|
||||||
if (isObject(source)) {
|
if (isObject(source)) {
|
||||||
|
var i, newTarget, newSource;
|
||||||
for (i in source) {
|
for (i in source) {
|
||||||
if (source.hasOwnProperty(i)) {
|
if (source.hasOwnProperty(i)) {
|
||||||
newTarget = target[i];
|
newTarget = target[i];
|
||||||
|
@ -48,9 +49,13 @@ window.WebPage = function (opts) {
|
||||||
newTarget = newSource;
|
newTarget = newSource;
|
||||||
}
|
}
|
||||||
|
|
||||||
target[i] = newTarget;
|
if (!isUndefined(newTarget)) {
|
||||||
|
target[i] = newTarget;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
target = source;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue