mount-observer 0.0.54 → 0.0.55

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/Newish.js CHANGED
@@ -1,5 +1,6 @@
1
1
  export { waitForEvent } from './waitForEvent.js';
2
2
  import { ObsAttr } from './ObsAttr.js';
3
+ import { splitRefs } from './itemRefUtils/splitRefs.js';
3
4
  export const attached = Symbol.for('xyyspnstnU+CDrNVa0VnxA');
4
5
  export class Newish {
5
6
  queue = [];
@@ -64,7 +65,9 @@ export class Newish {
64
65
  // and call outOfScopeCallback on them
65
66
  if (enhancedElement.hasAttribute('itemref')) {
66
67
  const itemref = enhancedElement.getAttribute('itemref');
67
- const itemrefList = itemref.split(' ');
68
+ const itemrefList = splitRefs(itemref); // itemref.split(' ').map((id) => id.trim()).filter((id) => id.length > 0);
69
+ if (itemrefList.length === 0)
70
+ return;
68
71
  const rn = enhancedElement.getRootNode();
69
72
  for (const id of itemrefList) {
70
73
  if (this.#alreadyAttached.has(id))
package/Newish.ts CHANGED
@@ -2,6 +2,7 @@ import { Assigner, BindishOptions } from './ts-refs/mount-observer/types.js';
2
2
 
3
3
  export {waitForEvent} from './waitForEvent.js';
4
4
  import {ObsAttr} from './ObsAttr.js';
5
+ import {splitRefs} from './itemRefUtils/splitRefs.js';
5
6
  export const attached = Symbol.for('xyyspnstnU+CDrNVa0VnxA');
6
7
  export class Newish implements EventListenerObject {
7
8
  queue: Array<any> = [];
@@ -70,7 +71,8 @@ export class Newish implements EventListenerObject {
70
71
  // and call outOfScopeCallback on them
71
72
  if(enhancedElement.hasAttribute('itemref')){
72
73
  const itemref = enhancedElement.getAttribute('itemref')!;
73
- const itemrefList = itemref.split(' ');
74
+ const itemrefList = splitRefs(itemref);// itemref.split(' ').map((id) => id.trim()).filter((id) => id.length > 0);
75
+ if(itemrefList.length === 0) return;
74
76
  const rn = enhancedElement.getRootNode() as Document | ShadowRoot;
75
77
  for(const id of itemrefList){
76
78
  if(this.#alreadyAttached.has(id)) continue;
@@ -0,0 +1,6 @@
1
+ export function splitRefs(refs) {
2
+ return refs
3
+ .split(' ')
4
+ .map(s => s.trim())
5
+ .filter(s => !!s);
6
+ }
@@ -0,0 +1,6 @@
1
+ export function splitRefs(refs: string){
2
+ return refs
3
+ .split(' ')
4
+ .map(s => s.trim())
5
+ .filter(s => !!s);
6
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mount-observer",
3
- "version": "0.0.54",
3
+ "version": "0.0.55",
4
4
  "description": "Observe and act on css matches.",
5
5
  "main": "MountObserver.js",
6
6
  "module": "MountObserver.js",
@@ -44,12 +44,17 @@
44
44
  "./waitForIsh.js": {
45
45
  "default": "./waitForIsh.js",
46
46
  "types": "./waitForIsh.ts"
47
+ },
48
+ "./itemRefUtils/splitRefs.js": {
49
+ "default": "./itemRefUtils/splitRefs.js",
50
+ "types": "./itemRefUtils/splitRefs.ts"
47
51
  }
48
52
  },
49
53
  "files": [
50
54
  "*.js",
51
55
  "*.ts",
52
- "./ts-refs/*"
56
+ "./ts-refs/*",
57
+ "./itemRefUtils/*"
53
58
  ],
54
59
  "types": "./ts-refs/mount-observer/types.d.ts",
55
60
  "scripts": {