mount-observer 0.0.85 → 0.0.87

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mount-observer",
3
- "version": "0.0.85",
3
+ "version": "0.0.87",
4
4
  "description": "Observe and act on css matches.",
5
5
  "main": "MountObserver.js",
6
6
  "module": "MountObserver.js",
@@ -41,10 +41,6 @@
41
41
  "default": "./doCleanup.js",
42
42
  "types": "./doCleanup.ts"
43
43
  },
44
- "./getContent.js": {
45
- "default": "./getContent.js",
46
- "types": "./getContent.ts"
47
- },
48
44
  "./waitForEvent.js": {
49
45
  "default": "./waitForEvent.js",
50
46
  "types": "./waitForEvent.ts"
package/upShadowSearch.js CHANGED
@@ -14,9 +14,12 @@ export function upShadowSearch(ref, id) {
14
14
  return null;
15
15
  }
16
16
  else if (!rn.isConnected) {
17
- //TODO: search first for targetFragment
18
- rn = document;
17
+ if (rn.targetFragment) {
18
+ rn = rn.targetFragment;
19
+ }
20
+ else {
21
+ rn = document;
22
+ }
19
23
  }
20
- //return null;
21
24
  }
22
25
  }
package/upShadowSearch.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  export function upShadowSearch(ref: Element, id: string){
2
- let rn = ref.getRootNode() as (Document | DocumentFragment | ShadowRoot) & { host?: Element };
2
+ let rn = ref.getRootNode() as any;
3
3
  while(rn){
4
4
  let test = rn.getElementById(id);
5
5
  if(test) return test;
@@ -10,11 +10,14 @@ export function upShadowSearch(ref: Element, id: string){
10
10
  }else if(rn === document){
11
11
  return null;
12
12
  }else if(!rn.isConnected){
13
- //TODO: search first for targetFragment
14
- rn = document;
13
+ if(rn.targetFragment){
14
+ rn = rn.targetFragment;
15
+ }else{
16
+ rn = document;
17
+ }
18
+
15
19
 
16
20
  }
17
- //return null;
18
21
  }
19
22
  }
20
23
 
package/getContent.js DELETED
@@ -1,10 +0,0 @@
1
- import { waitForEvent } from './waitForEvent.js';
2
- export async function getContent(templ) {
3
- const templWithRemoteContent = templ;
4
- if (templWithRemoteContent.remoteContent)
5
- return templWithRemoteContent.remoteContent;
6
- await waitForEvent(templ, 'load');
7
- if (templWithRemoteContent.remoteContent)
8
- return templWithRemoteContent.remoteContent;
9
- throw 500; //remote content not loaded
10
- }
package/getContent.ts DELETED
@@ -1,10 +0,0 @@
1
- import {waitForEvent} from './waitForEvent.js';
2
- import {TemplateWithRemoteContent} from './ts-refs/mount-observer/types.js';
3
-
4
- export async function getContent(templ: HTMLTemplateElement) {
5
- const templWithRemoteContent = templ as TemplateWithRemoteContent;
6
- if(templWithRemoteContent.remoteContent) return templWithRemoteContent.remoteContent;
7
- await waitForEvent(templ, 'load');
8
- if(templWithRemoteContent.remoteContent) return templWithRemoteContent.remoteContent;
9
- throw 500; //remote content not loaded
10
- }