From 7497b8352529f010eb962c2676b56b3f9f2c8b89 Mon Sep 17 00:00:00 2001 From: Joe DF <3848219+joedf@users.noreply.github.com> Date: Sat, 10 Sep 2022 21:31:15 -0400 Subject: [PATCH 1/2] based on @pearcetm 's fix --- src/openseadragon.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/openseadragon.js b/src/openseadragon.js index 87858e29..32189538 100644 --- a/src/openseadragon.js +++ b/src/openseadragon.js @@ -1102,7 +1102,7 @@ function OpenSeadragon( options ){ // Extend the base object for ( name in options ) { src = target[ name ]; - copy = options[ name ]; + copy = Object.getOwnPropertyDescriptor(options, name).value; // Prevent never-ending loop if ( target === copy ) { From 6d74b684ecefe64894707f32a34899fcaf73c2ab Mon Sep 17 00:00:00 2001 From: Joe DF <3848219+joedf@users.noreply.github.com> Date: Sat, 17 Sep 2022 17:10:03 +0200 Subject: [PATCH 2/2] implement @iangilman 's fix --- src/openseadragon.js | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/openseadragon.js b/src/openseadragon.js index 32189538..685ef10f 100644 --- a/src/openseadragon.js +++ b/src/openseadragon.js @@ -1101,8 +1101,13 @@ function OpenSeadragon( options ){ if ( options !== null || options !== undefined ) { // Extend the base object for ( name in options ) { - src = target[ name ]; - copy = Object.getOwnPropertyDescriptor(options, name).value; + var descriptor = Object.getOwnPropertyDescriptor(options, name); + if (descriptor.get || descriptor.set) { + Object.defineProperty(target, name, descriptor); + continue; + } + + copy = descriptor.value; // Prevent never-ending loop if ( target === copy ) { @@ -1111,6 +1116,8 @@ function OpenSeadragon( options ){ // Recurse if we're merging plain objects or arrays if ( deep && copy && ( OpenSeadragon.isPlainObject( copy ) || ( copyIsArray = OpenSeadragon.isArray( copy ) ) ) ) { + src = target[ name ]; + if ( copyIsArray ) { copyIsArray = false; clone = src && OpenSeadragon.isArray( src ) ? src : [];