diff --git a/webclient/src/core.js b/webclient/src/core.js index 0ce6618b5..f7fe5f35b 100644 --- a/webclient/src/core.js +++ b/webclient/src/core.js @@ -71,35 +71,28 @@ const cachedFetch = (() => ({ // the following is a poor implementation of a structuredClone(item) polyfill // (read: this is not the full implementation browsers follow, but a simplified version) -// TODO: remove this, once Samsung Internet implements this. See https://caniuse.com/mdn-api_structuredclone - -console.debug({scType:typeof structuredClone}) -if (typeof structuredClone === "undefined") { - console.warn("You are using an out of date browser. Please consider upgrading it.") - // eslint-disable-next-line no-inner-declarations, no-unused-vars - function structuredClone(item) { - // cf. StackOverflow: https://stackoverflow.com/questions/728360/how-do-i-correctly-clone-a-javascript-object - // item has to be serializable! - if (item == null || typeof item !== "object") return item; - // Arrays are currently not cloned (TODO: is this required?) - if (item instanceof Array) { - return item; - } - if (!(item instanceof Object)) - console.error( - `Items of type ${typeof item} (${item}) cant be structuredClone'd` - ); - - const copy = {}; - Object.keys(item).forEach((key) => { - if ( - key !== "__ob__" && // stuff by vue, recursive! - Object.prototype.hasOwnProperty.call(item, key) // google no-prototype-builtins for an explanation of this line - ) - copy[key] = structuredClone(item[key]); - }); - return copy; +function structuredClone(item) { + // cf. StackOverflow: https://stackoverflow.com/questions/728360/how-do-i-correctly-clone-a-javascript-object + // item has to be serializable! + if (item == null || typeof item !== "object") return item; + // Arrays are currently not cloned (TODO: is this required?) + if (item instanceof Array) { + return item; } + if (!(item instanceof Object)) + console.error( + `Items of type ${typeof item} (${item}) cant be structuredClone'd` + ); + + const copy = {}; + Object.keys(item).forEach((key) => { + if ( + key !== "__ob__" && // stuff by vue, recursive! + Object.prototype.hasOwnProperty.call(item, key) // google no-prototype-builtins for an explanation of this line + ) + copy[key] = structuredClone(item[key]); + }); + return copy; } navigatum = (() => {