u2ui 1.5.17 → 1.5.18

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.
@@ -103,6 +103,7 @@ contain: layout style paint; /* Neu ok? */
103
103
  }
104
104
  :host([mode=fade]) .body {
105
105
  display:flex;
106
+ min-width: 0;
106
107
  }
107
108
  :host([mode=fade]) .body::slotted(*) {
108
109
  transition:opacity var(--u2-carousel-animation-speed, .7s) ease-in-out;
@@ -12,19 +12,18 @@ function forRoot(root, method, el) {
12
12
  for (const observer of observers) observer.root === root && observer[method](el);
13
13
  }
14
14
  function checkMutations(mutations, root) {
15
- for (const mutation of mutations) {
16
- if (mutation.type==='childList') {
17
- for (const target of mutation.addedNodes) {
18
- target.nodeType === 1 && forRoot(root, '_addTree', target);
19
- }
20
- for (const target of mutation.removedNodes) {
21
- target.nodeType === 1 && forRoot(root, '_removeTree', target);
22
- }
23
- }
24
- if (mutation.type==='attributes') {
25
- forRoot(root, '_treeModified', mutation.target);
26
- }
15
+ const added = new Set(), removed = new Set(), modified = new Set();
16
+ for (const m of mutations) {
17
+ if (m.type === 'attributes') { modified.add(m.target); continue; }
18
+ for (const n of m.removedNodes) n.nodeType === 1 && removed.add(n);
19
+ for (const n of m.addedNodes) n.nodeType === 1 && added.add(n);
27
20
  }
21
+ // a node inside another node of the same batch is covered by that node's subtree
22
+ const top = (n, set) => { for (let p = n.parentNode; p; p = p.parentNode) if (set.has(p)) return false; return true; };
23
+ for (const n of removed) top(n, removed) && forRoot(root, '_removeTree', n);
24
+ // judged by the final state: a node that left again, or was only touched while detached, is not added
25
+ for (const n of added) top(n, added) && root.contains(n) && forRoot(root, '_addTree', n);
26
+ for (const n of modified) root.contains(n) && forRoot(root, '_treeModified', n);
28
27
  }
29
28
 
30
29
 
@@ -140,16 +139,15 @@ export class SelectorObserver {
140
139
  */
141
140
  _addTree(target) {
142
141
  target.matches(this.selector) && this._add(target);
143
- if (document.readyState === 'complete') { // Before domready MutationObserver reports every node, ok?
144
- for (const el of target.querySelectorAll(this.selector)) this._add(el);
145
- }
142
+ // a scripted insert is reported as its root only, even while parsing; nodes found twice are deduped by targets
143
+ for (const el of target.querySelectorAll(this.selector)) this._add(el);
146
144
  }
147
145
 
148
146
  /**
149
147
  * @private
150
148
  */
151
149
  _removeTree(target) {
152
- //if (!this._off) return; // performance
150
+ if (!this.targets.size) return;
153
151
  this._remove(target);
154
152
  for (const el of target.querySelectorAll('*')) this._remove(el);
155
153
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "u2ui",
3
- "version": "1.5.17",
3
+ "version": "1.5.18",
4
4
  "description": "HTML Advanced: More Capabilities, Same Feel, Same Simplicity",
5
5
  "keywords": ["web-components","pattern-library","component-library","ui-toolkit","design-system"],
6
6
  "author": "Tobias Buschor",