diff --git a/dss/findR.js b/dss/findR.js index a8289a5c..ac8765e1 100644 --- a/dss/findR.js +++ b/dss/findR.js @@ -1,24 +1,4 @@ -async function getHostish(el) { - let { localName, ish } = el; - if (localName.includes('-')) { - await customElements.whenDefined(localName); - return el; - } - if (ish instanceof HTMLElement) - return ish; - const itemScopeAttr = el.getAttribute('itemscope'); - if (itemScopeAttr) { - //let ish = (el).ish as HTMLElement | undefined; - //if(host) return getHostish(host, prop); - const { Newish, waitForEvent } = await import('./Newish.js'); - const ah = new Newish(el, itemScopeAttr); - if (!ah.isResolved) { - await waitForEvent(ah, 'resolved'); - } - ish = el.ish; - return ish; - } -} +import { getHostish } from './getHostish.js'; export async function findR(element, specifier, scopeE) { const { scopeS, elS, isModulo } = specifier; if (scopeS !== undefined) { diff --git a/dss/findR.ts b/dss/findR.ts index 8bf7b3bd..5b3bb13b 100644 --- a/dss/findR.ts +++ b/dss/findR.ts @@ -1,27 +1,6 @@ import { Specifier } from "../ts-refs/trans-render/dss/types"; -import {ZeroOrMore} from '../ts-refs/trans-render/types'; +import {getHostish} from './getHostish.js'; -async function getHostish(el: Element){ - let {localName, ish} = el as any; - if(localName.includes('-')){ - await customElements.whenDefined(localName); - return el; - } - if(ish instanceof HTMLElement) return ish; - const itemScopeAttr = el.getAttribute('itemscope'); - if(itemScopeAttr){ - //let ish = (el).ish as HTMLElement | undefined; - //if(host) return getHostish(host, prop); - const {Newish, waitForEvent} = await import('./Newish.js'); - const ah = new Newish(el, itemScopeAttr); - if(!ah.isResolved){ - await waitForEvent(ah, 'resolved'); - } - ish = (el).ish as HTMLElement | undefined; - return ish; - - } -} export async function findR(element: Element, specifier: Specifier, scopeE?: Element | undefined){ const {scopeS, elS, isModulo} = specifier; diff --git a/dss/getHostish.js b/dss/getHostish.js new file mode 100644 index 00000000..d3dac3bf --- /dev/null +++ b/dss/getHostish.js @@ -0,0 +1,21 @@ +export async function getHostish(el) { + let { localName, ish } = el; + if (localName.includes('-')) { + await customElements.whenDefined(localName); + return el; + } + if (ish instanceof HTMLElement) + return ish; + const itemScopeAttr = el.getAttribute('itemscope'); + if (itemScopeAttr) { + //let ish = (el).ish as HTMLElement | undefined; + //if(host) return getHostish(host, prop); + const { Newish, waitForEvent } = await import('./Newish.js'); + const ah = new Newish(el, itemScopeAttr); + if (!ah.isResolved) { + await waitForEvent(ah, 'resolved'); + } + ish = el.ish; + return ish; + } +} diff --git a/dss/getHostish.ts b/dss/getHostish.ts new file mode 100644 index 00000000..a24ac26f --- /dev/null +++ b/dss/getHostish.ts @@ -0,0 +1,21 @@ +export async function getHostish(el: Element){ + let {localName, ish} = el as any; + if(localName.includes('-')){ + await customElements.whenDefined(localName); + return el; + } + if(ish instanceof HTMLElement) return ish; + const itemScopeAttr = el.getAttribute('itemscope'); + if(itemScopeAttr){ + //let ish = (el).ish as HTMLElement | undefined; + //if(host) return getHostish(host, prop); + const {Newish, waitForEvent} = await import('./Newish.js'); + const ah = new Newish(el, itemScopeAttr); + if(!ah.isResolved){ + await waitForEvent(ah, 'resolved'); + } + ish = (el).ish as HTMLElement | undefined; + return ish; + + } +} \ No newline at end of file diff --git a/package.json b/package.json index 18e5db3d..f7a9b3ca 100644 --- a/package.json +++ b/package.json @@ -63,6 +63,10 @@ "default": "./lib/findR.js", "types": "./lib/findR.ts" }, + "./dss/getHostish.js": { + "default": "./dss/getHostish.js", + "types": "./dss/getHostish.ts" + }, "./dss/tref/getChildren.js": { "default": "./dss/tref/getChildren.js", "types": "./dss/tref/getChildren.ts"