Small Fix in JSONEditor

This commit is contained in:
Jos de Jong 2020-08-16 11:54:03 +02:00
parent 8b99527604
commit 8256bd637c
2 changed files with 8 additions and 8 deletions

View File

@ -2,17 +2,16 @@
import Modal from 'svelte-simple-modal'
import TreeMode from './treemode/TreeMode.svelte'
export let config = {}
let mode
let restConfig
const DefaultMode = TreeMode
$: {
let { _mode, ..._restConfig } = config
mode = _mode
restConfig = _restConfig
export let config = {}
function getRestConfig (config) {
let { mode, ...restConfig } = config
return restConfig
}
</script>
<Modal>
<svelte:component this={mode || TreeMode} {...restConfig} />
<svelte:component this={config.mode || DefaultMode} {...getRestConfig(config)} />
</Modal>

View File

@ -205,6 +205,7 @@ function hasAttribute(element, name, value) {
* @returns {*}
*/
export function isChildOf (element, predicate) {
// TODO: can we replace isChildOf with Element.closest?
let e = element
while (e && !predicate(e)) {