@solidjs/web 2.0.0-beta.6 → 2.0.0-beta.7

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/dist/web.cjs CHANGED
@@ -6,9 +6,9 @@ var signals = require('@solidjs/signals');
6
6
  const DOMWithState = {
7
7
  INPUT: {
8
8
  value: 1,
9
- defaultValue: 1,
9
+ defaultValue: 2,
10
10
  checked: 1,
11
- defaultChecked: 1
11
+ defaultChecked: 2
12
12
  },
13
13
  SELECT: {
14
14
  value: 1
@@ -16,26 +16,21 @@ const DOMWithState = {
16
16
  OPTION: {
17
17
  value: 1,
18
18
  selected: 1,
19
- defaultSelected: 1
19
+ defaultSelected: 2
20
20
  },
21
21
  TEXTAREA: {
22
22
  value: 1,
23
- defaultValue: 1
23
+ defaultValue: 2
24
24
  },
25
25
  VIDEO: {
26
26
  muted: 1,
27
- defaultMuted: 1
27
+ defaultMuted: 2
28
28
  },
29
29
  AUDIO: {
30
30
  muted: 1,
31
- defaultMuted: 1
31
+ defaultMuted: 2
32
32
  }
33
33
  };
34
- for (const tagName in DOMWithState) {
35
- for (const propName in DOMWithState[tagName]) {
36
- DOMWithState[tagName]["prop:" + propName] = 1;
37
- }
38
- }
39
34
  const ChildProperties = /*#__PURE__*/new Set(["innerHTML", "textContent", "innerText", "children"]);
40
35
  const DelegatedEvents = /*#__PURE__*/new Set(["beforeinput", "click", "dblclick", "contextmenu", "focusin", "focusout", "input", "keydown", "keyup", "mousedown", "mousemove", "mouseout", "mouseover", "mouseup", "pointerdown", "pointermove", "pointerout", "pointerover", "pointerup", "touchend", "touchmove", "touchstart"]);
41
36
  const SVGElements = /*#__PURE__*/new Set([
@@ -54,10 +49,10 @@ const DOMElements = /*#__PURE__*/new Set(["html", "base", "head", "link", "meta"
54
49
  "webview",
55
50
  "isindex", "listing", "multicol", "nextid", "noindex", "search"]);
56
51
 
57
- const effect = (fn, effectFn, initial) => solidJs.createRenderEffect(fn, effectFn, initial, {
52
+ const effect = (fn, effectFn) => solidJs.createRenderEffect(fn, effectFn, {
58
53
  transparent: true
59
54
  });
60
- const memo = (fn, transparent) => transparent ? fn.$r ? fn : signals.createMemo(() => fn(), undefined, {
55
+ const memo = (fn, transparent) => transparent ? fn.$r ? fn : signals.createMemo(() => fn(), {
61
56
  transparent: true
62
57
  }) : solidJs.createMemo(() => fn());
63
58
 
@@ -120,16 +115,17 @@ function reconcileArrays(parentNode, a, b) {
120
115
 
121
116
  const $$EVENTS = "_$DX_DELEGATE";
122
117
  function render$1(code, element, init, options = {}) {
118
+ const renderRoot = getChildRoot(element);
123
119
  let disposer;
124
120
  solidJs.createRoot(dispose => {
125
121
  disposer = dispose;
126
- element === document ? solidJs.flatten(code) : insert(element, code(), element.firstChild ? null : undefined, init);
122
+ element === document ? solidJs.flatten(code) : insert(element, code(), renderRoot.firstChild ? null : undefined, init);
127
123
  }, {
128
124
  id: options.renderId
129
125
  });
130
126
  return () => {
131
127
  disposer();
132
- element.textContent = "";
128
+ renderRoot.textContent = "";
133
129
  };
134
130
  }
135
131
  function create(html, bypassGuard, flag) {
@@ -267,10 +263,11 @@ function ref(fn, element) {
267
263
  solidJs.runWithOwner(null, () => applyRef(resolved, element));
268
264
  }
269
265
  function insert(parent, accessor, marker, initial) {
266
+ const childRoot = getChildRoot(parent);
270
267
  const multi = marker !== undefined;
271
268
  if (multi && !initial) initial = [];
272
269
  if (isHydrating(parent)) {
273
- if (!multi && initial === undefined && parent) initial = [...parent.childNodes];
270
+ if (!multi && initial === undefined && parent) initial = [...childRoot.childNodes];
274
271
  if (Array.isArray(initial)) {
275
272
  let j = 0;
276
273
  for (let i = 0; i < initial.length; i++) {
@@ -286,10 +283,10 @@ function insert(parent, accessor, marker, initial) {
286
283
  accessor = memo(accessor, true);
287
284
  if (multi && initial.length === 0) {
288
285
  const placeholder = document.createTextNode("");
289
- parent.insertBefore(placeholder, marker);
286
+ childRoot.insertBefore(placeholder, marker);
290
287
  initial = [placeholder];
291
288
  }
292
- effect(prev => normalize(accessor, prev, multi), (value, current) => insertExpression(parent, value, current, marker), initial);
289
+ effect((prev = initial) => normalize(accessor, prev, multi), (value, current = initial) => insertExpression(parent, value, current, marker));
293
290
  }
294
291
  function assign(node, props, skipChildren, prevProps = {}, skipRef = false) {
295
292
  const nodeName = node.nodeName;
@@ -308,8 +305,24 @@ function assign(node, props, skipChildren, prevProps = {}, skipRef = false) {
308
305
  prevProps[prop] = assignProp(node, prop, props[prop], prevProps[prop], skipRef, nodeName);
309
306
  }
310
307
  }
308
+ function loadModuleAssets(mapping) {
309
+ const hy = globalThis._$HY;
310
+ if (!hy) return;
311
+ const pending = [];
312
+ for (const moduleUrl in mapping) {
313
+ if (hy.modules[moduleUrl]) continue;
314
+ const entryUrl = mapping[moduleUrl];
315
+ if (!hy.loading[moduleUrl]) {
316
+ hy.loading[moduleUrl] = import(entryUrl).then(mod => {
317
+ hy.modules[moduleUrl] = mod;
318
+ });
319
+ }
320
+ pending.push(hy.loading[moduleUrl]);
321
+ }
322
+ return pending.length ? Promise.all(pending).then(() => {}) : undefined;
323
+ }
311
324
  function hydrate$1(code, element, options = {}) {
312
- if (globalThis._$HY.done) return render$1(code, element, [...element.childNodes], options);
325
+ if (globalThis._$HY.done) return render$1(code, element, [...getChildRoot(element).childNodes], options);
313
326
  options.renderId ||= "";
314
327
  if (!globalThis._$HY.modules) globalThis._$HY.modules = {};
315
328
  if (!globalThis._$HY.loading) globalThis._$HY.loading = {};
@@ -318,6 +331,7 @@ function hydrate$1(code, element, options = {}) {
318
331
  solidJs.sharedConfig.load = id => globalThis._$HY.r[id];
319
332
  solidJs.sharedConfig.has = id => id in globalThis._$HY.r;
320
333
  solidJs.sharedConfig.gather = root => gatherHydratable(element, root);
334
+ solidJs.sharedConfig.loadModuleAssets = loadModuleAssets;
321
335
  solidJs.sharedConfig.cleanupFragment = id => {
322
336
  const tpl = document.getElementById("pl-" + id);
323
337
  if (tpl) {
@@ -336,9 +350,27 @@ function hydrate$1(code, element, options = {}) {
336
350
  };
337
351
  solidJs.sharedConfig.registry = new Map();
338
352
  solidJs.sharedConfig.hydrating = true;
353
+ const rootMapping = globalThis._$HY.r && globalThis._$HY.r["_assets"];
354
+ if (rootMapping && typeof rootMapping === "object") {
355
+ const p = loadModuleAssets(rootMapping);
356
+ if (p) {
357
+ gatherHydratable(element, options.renderId);
358
+ let disposer;
359
+ p.then(() => {
360
+ try {
361
+ disposer = render$1(code, element, [...getChildRoot(element).childNodes], options);
362
+ } finally {
363
+ solidJs.sharedConfig.hydrating = false;
364
+ }
365
+ }, () => {
366
+ solidJs.sharedConfig.hydrating = false;
367
+ });
368
+ return () => disposer && disposer();
369
+ }
370
+ }
339
371
  try {
340
372
  gatherHydratable(element, options.renderId);
341
- return render$1(code, element, [...element.childNodes], options);
373
+ return render$1(code, element, [...getChildRoot(element).childNodes], options);
342
374
  } finally {
343
375
  solidJs.sharedConfig.hydrating = false;
344
376
  }
@@ -381,7 +413,7 @@ function getNextMarker(start) {
381
413
  return [end, current];
382
414
  }
383
415
  function getFirstChild(node, expectedTag) {
384
- const child = node.firstChild;
416
+ const child = getChildRoot(node).firstChild;
385
417
  return child;
386
418
  }
387
419
  function getNextSibling(node, expectedTag) {
@@ -414,6 +446,9 @@ function runHydrationEvents() {
414
446
  function isHydrating(node) {
415
447
  return solidJs.sharedConfig.hydrating && (!node || node.isConnected);
416
448
  }
449
+ function getChildRoot(node) {
450
+ return node && node.localName === "template" ? node.content : node;
451
+ }
417
452
  function toggleClassKey(node, key, value) {
418
453
  const classNames = key.trim().split(/\s+/);
419
454
  for (let i = 0, nameLen = classNames.length; i < nameLen; i++) node.classList.toggle(classNames[i], value);
@@ -435,7 +470,7 @@ function flattenClassList(list, result) {
435
470
  function assignProp(node, prop, value, prev, skipRef, nodeName) {
436
471
  if (prop === "style") return style(node, value, prev), value;
437
472
  if (prop === "class") return className(node, value, prev), value;
438
- if (value === prev && !DOMWithState[nodeName]?.[prop]) return prev;
473
+ if (value === prev && DOMWithState[nodeName]?.[prop] !== 1) return prev;
439
474
  if (prop === "ref") {
440
475
  if (!skipRef && value) ref(() => value, node);
441
476
  return value;
@@ -518,21 +553,22 @@ function eventHandler(e) {
518
553
  function insertExpression(parent, value, current, marker) {
519
554
  if (isHydrating(parent)) return;
520
555
  if (value === current) return;
556
+ const childRoot = getChildRoot(parent);
521
557
  const t = typeof value,
522
558
  multi = marker !== undefined;
523
559
  if (t === "string" || t === "number") {
524
560
  const tc = typeof current;
525
561
  if (tc === "string" || tc === "number") {
526
- parent.firstChild.data = value;
527
- } else parent.textContent = value;
562
+ childRoot.firstChild.data = value;
563
+ } else childRoot.textContent = value;
528
564
  } else if (value === undefined) {
529
565
  cleanChildren(parent, current, marker);
530
566
  } else if (value.nodeType) {
531
567
  if (Array.isArray(current)) {
532
568
  cleanChildren(parent, current, multi ? marker : null, value);
533
- } else if (current === undefined || !parent.firstChild) {
534
- parent.appendChild(value);
535
- } else parent.replaceChild(value, parent.firstChild);
569
+ } else if (current === undefined || !childRoot.firstChild) {
570
+ childRoot.appendChild(value);
571
+ } else childRoot.replaceChild(value, childRoot.firstChild);
536
572
  } else if (Array.isArray(value)) {
537
573
  const currentArray = current && Array.isArray(current);
538
574
  if (value.length === 0) {
@@ -540,7 +576,7 @@ function insertExpression(parent, value, current, marker) {
540
576
  } else if (currentArray) {
541
577
  if (current.length === 0) {
542
578
  appendNodes(parent, value, marker);
543
- } else reconcileArrays(parent, current, value);
579
+ } else reconcileArrays(childRoot, current, value);
544
580
  } else {
545
581
  current && cleanChildren(parent);
546
582
  appendNodes(parent, value);
@@ -565,9 +601,11 @@ function normalize(value, current, multi, doNotUnwrap) {
565
601
  return value;
566
602
  }
567
603
  function appendNodes(parent, array, marker = null) {
604
+ parent = getChildRoot(parent);
568
605
  for (let i = 0, len = array.length; i < len; i++) parent.insertBefore(array[i], marker);
569
606
  }
570
607
  function cleanChildren(parent, current, marker, replacement) {
608
+ parent = getChildRoot(parent);
571
609
  if (marker === undefined) return parent.textContent = "";
572
610
  if (current.length) {
573
611
  let inserted = false;
@@ -622,9 +660,8 @@ function render(...args) {
622
660
  }
623
661
  const isServer = false;
624
662
  const isDev = false;
625
- const SVG_NAMESPACE = "http://www.w3.org/2000/svg";
626
- function createElement(tagName, isSVG = false, is = undefined) {
627
- return isSVG ? document.createElementNS(SVG_NAMESPACE, tagName) : document.createElement(tagName, {
663
+ function createElement(tagName, is = undefined) {
664
+ return SVGElements.has(tagName) ? document.createElementNS(Namespaces.svg, tagName) : MathMLElements.has(tagName) ? document.createElementNS(Namespaces.mathml, tagName) : document.createElement(tagName, {
628
665
  is
629
666
  });
630
667
  }
@@ -677,9 +714,8 @@ function createDynamic(component, props) {
677
714
  case "function":
678
715
  return solidJs.untrack(() => component(props));
679
716
  case "string":
680
- const isSvg = SVGElements.has(component);
681
- const el = solidJs.sharedConfig.hydrating ? getNextElement() : createElement(component, isSvg, solidJs.untrack(() => props.is));
682
- spread(el, props, isSvg);
717
+ const el = solidJs.sharedConfig.hydrating ? getNextElement() : createElement(component, solidJs.untrack(() => props.is));
718
+ spread(el, props);
683
719
  return el;
684
720
  }
685
721
  });
@@ -713,6 +749,10 @@ Object.defineProperty(exports, "NoHydration", {
713
749
  enumerable: true,
714
750
  get: function () { return solidJs.NoHydration; }
715
751
  });
752
+ Object.defineProperty(exports, "Repeat", {
753
+ enumerable: true,
754
+ get: function () { return solidJs.Repeat; }
755
+ });
716
756
  Object.defineProperty(exports, "Reveal", {
717
757
  enumerable: true,
718
758
  get: function () { return solidJs.Reveal; }
package/dist/web.js CHANGED
@@ -1,13 +1,13 @@
1
1
  import { createRenderEffect, createMemo as createMemo$1, sharedConfig, untrack, runWithOwner, flatten, createRoot, omit, enableHydration } from 'solid-js';
2
- export { Errored, For, Hydration, Loading, Match, NoHydration, Reveal, Show, Switch, createComponent, getOwner, merge as mergeProps, untrack } from 'solid-js';
2
+ export { Errored, For, Hydration, Loading, Match, NoHydration, Repeat, Reveal, Show, Switch, createComponent, getOwner, merge as mergeProps, untrack } from 'solid-js';
3
3
  import { createMemo } from '@solidjs/signals';
4
4
 
5
5
  const DOMWithState = {
6
6
  INPUT: {
7
7
  value: 1,
8
- defaultValue: 1,
8
+ defaultValue: 2,
9
9
  checked: 1,
10
- defaultChecked: 1
10
+ defaultChecked: 2
11
11
  },
12
12
  SELECT: {
13
13
  value: 1
@@ -15,26 +15,21 @@ const DOMWithState = {
15
15
  OPTION: {
16
16
  value: 1,
17
17
  selected: 1,
18
- defaultSelected: 1
18
+ defaultSelected: 2
19
19
  },
20
20
  TEXTAREA: {
21
21
  value: 1,
22
- defaultValue: 1
22
+ defaultValue: 2
23
23
  },
24
24
  VIDEO: {
25
25
  muted: 1,
26
- defaultMuted: 1
26
+ defaultMuted: 2
27
27
  },
28
28
  AUDIO: {
29
29
  muted: 1,
30
- defaultMuted: 1
30
+ defaultMuted: 2
31
31
  }
32
32
  };
33
- for (const tagName in DOMWithState) {
34
- for (const propName in DOMWithState[tagName]) {
35
- DOMWithState[tagName]["prop:" + propName] = 1;
36
- }
37
- }
38
33
  const ChildProperties = /*#__PURE__*/new Set(["innerHTML", "textContent", "innerText", "children"]);
39
34
  const DelegatedEvents = /*#__PURE__*/new Set(["beforeinput", "click", "dblclick", "contextmenu", "focusin", "focusout", "input", "keydown", "keyup", "mousedown", "mousemove", "mouseout", "mouseover", "mouseup", "pointerdown", "pointermove", "pointerout", "pointerover", "pointerup", "touchend", "touchmove", "touchstart"]);
40
35
  const SVGElements = /*#__PURE__*/new Set([
@@ -53,10 +48,10 @@ const DOMElements = /*#__PURE__*/new Set(["html", "base", "head", "link", "meta"
53
48
  "webview",
54
49
  "isindex", "listing", "multicol", "nextid", "noindex", "search"]);
55
50
 
56
- const effect = (fn, effectFn, initial) => createRenderEffect(fn, effectFn, initial, {
51
+ const effect = (fn, effectFn) => createRenderEffect(fn, effectFn, {
57
52
  transparent: true
58
53
  });
59
- const memo = (fn, transparent) => transparent ? fn.$r ? fn : createMemo(() => fn(), undefined, {
54
+ const memo = (fn, transparent) => transparent ? fn.$r ? fn : createMemo(() => fn(), {
60
55
  transparent: true
61
56
  }) : createMemo$1(() => fn());
62
57
 
@@ -119,16 +114,17 @@ function reconcileArrays(parentNode, a, b) {
119
114
 
120
115
  const $$EVENTS = "_$DX_DELEGATE";
121
116
  function render$1(code, element, init, options = {}) {
117
+ const renderRoot = getChildRoot(element);
122
118
  let disposer;
123
119
  createRoot(dispose => {
124
120
  disposer = dispose;
125
- element === document ? flatten(code) : insert(element, code(), element.firstChild ? null : undefined, init);
121
+ element === document ? flatten(code) : insert(element, code(), renderRoot.firstChild ? null : undefined, init);
126
122
  }, {
127
123
  id: options.renderId
128
124
  });
129
125
  return () => {
130
126
  disposer();
131
- element.textContent = "";
127
+ renderRoot.textContent = "";
132
128
  };
133
129
  }
134
130
  function create(html, bypassGuard, flag) {
@@ -266,10 +262,11 @@ function ref(fn, element) {
266
262
  runWithOwner(null, () => applyRef(resolved, element));
267
263
  }
268
264
  function insert(parent, accessor, marker, initial) {
265
+ const childRoot = getChildRoot(parent);
269
266
  const multi = marker !== undefined;
270
267
  if (multi && !initial) initial = [];
271
268
  if (isHydrating(parent)) {
272
- if (!multi && initial === undefined && parent) initial = [...parent.childNodes];
269
+ if (!multi && initial === undefined && parent) initial = [...childRoot.childNodes];
273
270
  if (Array.isArray(initial)) {
274
271
  let j = 0;
275
272
  for (let i = 0; i < initial.length; i++) {
@@ -285,10 +282,10 @@ function insert(parent, accessor, marker, initial) {
285
282
  accessor = memo(accessor, true);
286
283
  if (multi && initial.length === 0) {
287
284
  const placeholder = document.createTextNode("");
288
- parent.insertBefore(placeholder, marker);
285
+ childRoot.insertBefore(placeholder, marker);
289
286
  initial = [placeholder];
290
287
  }
291
- effect(prev => normalize(accessor, prev, multi), (value, current) => insertExpression(parent, value, current, marker), initial);
288
+ effect((prev = initial) => normalize(accessor, prev, multi), (value, current = initial) => insertExpression(parent, value, current, marker));
292
289
  }
293
290
  function assign(node, props, skipChildren, prevProps = {}, skipRef = false) {
294
291
  const nodeName = node.nodeName;
@@ -307,8 +304,24 @@ function assign(node, props, skipChildren, prevProps = {}, skipRef = false) {
307
304
  prevProps[prop] = assignProp(node, prop, props[prop], prevProps[prop], skipRef, nodeName);
308
305
  }
309
306
  }
307
+ function loadModuleAssets(mapping) {
308
+ const hy = globalThis._$HY;
309
+ if (!hy) return;
310
+ const pending = [];
311
+ for (const moduleUrl in mapping) {
312
+ if (hy.modules[moduleUrl]) continue;
313
+ const entryUrl = mapping[moduleUrl];
314
+ if (!hy.loading[moduleUrl]) {
315
+ hy.loading[moduleUrl] = import(entryUrl).then(mod => {
316
+ hy.modules[moduleUrl] = mod;
317
+ });
318
+ }
319
+ pending.push(hy.loading[moduleUrl]);
320
+ }
321
+ return pending.length ? Promise.all(pending).then(() => {}) : undefined;
322
+ }
310
323
  function hydrate$1(code, element, options = {}) {
311
- if (globalThis._$HY.done) return render$1(code, element, [...element.childNodes], options);
324
+ if (globalThis._$HY.done) return render$1(code, element, [...getChildRoot(element).childNodes], options);
312
325
  options.renderId ||= "";
313
326
  if (!globalThis._$HY.modules) globalThis._$HY.modules = {};
314
327
  if (!globalThis._$HY.loading) globalThis._$HY.loading = {};
@@ -317,6 +330,7 @@ function hydrate$1(code, element, options = {}) {
317
330
  sharedConfig.load = id => globalThis._$HY.r[id];
318
331
  sharedConfig.has = id => id in globalThis._$HY.r;
319
332
  sharedConfig.gather = root => gatherHydratable(element, root);
333
+ sharedConfig.loadModuleAssets = loadModuleAssets;
320
334
  sharedConfig.cleanupFragment = id => {
321
335
  const tpl = document.getElementById("pl-" + id);
322
336
  if (tpl) {
@@ -335,9 +349,27 @@ function hydrate$1(code, element, options = {}) {
335
349
  };
336
350
  sharedConfig.registry = new Map();
337
351
  sharedConfig.hydrating = true;
352
+ const rootMapping = globalThis._$HY.r && globalThis._$HY.r["_assets"];
353
+ if (rootMapping && typeof rootMapping === "object") {
354
+ const p = loadModuleAssets(rootMapping);
355
+ if (p) {
356
+ gatherHydratable(element, options.renderId);
357
+ let disposer;
358
+ p.then(() => {
359
+ try {
360
+ disposer = render$1(code, element, [...getChildRoot(element).childNodes], options);
361
+ } finally {
362
+ sharedConfig.hydrating = false;
363
+ }
364
+ }, () => {
365
+ sharedConfig.hydrating = false;
366
+ });
367
+ return () => disposer && disposer();
368
+ }
369
+ }
338
370
  try {
339
371
  gatherHydratable(element, options.renderId);
340
- return render$1(code, element, [...element.childNodes], options);
372
+ return render$1(code, element, [...getChildRoot(element).childNodes], options);
341
373
  } finally {
342
374
  sharedConfig.hydrating = false;
343
375
  }
@@ -380,7 +412,7 @@ function getNextMarker(start) {
380
412
  return [end, current];
381
413
  }
382
414
  function getFirstChild(node, expectedTag) {
383
- const child = node.firstChild;
415
+ const child = getChildRoot(node).firstChild;
384
416
  return child;
385
417
  }
386
418
  function getNextSibling(node, expectedTag) {
@@ -413,6 +445,9 @@ function runHydrationEvents() {
413
445
  function isHydrating(node) {
414
446
  return sharedConfig.hydrating && (!node || node.isConnected);
415
447
  }
448
+ function getChildRoot(node) {
449
+ return node && node.localName === "template" ? node.content : node;
450
+ }
416
451
  function toggleClassKey(node, key, value) {
417
452
  const classNames = key.trim().split(/\s+/);
418
453
  for (let i = 0, nameLen = classNames.length; i < nameLen; i++) node.classList.toggle(classNames[i], value);
@@ -434,7 +469,7 @@ function flattenClassList(list, result) {
434
469
  function assignProp(node, prop, value, prev, skipRef, nodeName) {
435
470
  if (prop === "style") return style(node, value, prev), value;
436
471
  if (prop === "class") return className(node, value, prev), value;
437
- if (value === prev && !DOMWithState[nodeName]?.[prop]) return prev;
472
+ if (value === prev && DOMWithState[nodeName]?.[prop] !== 1) return prev;
438
473
  if (prop === "ref") {
439
474
  if (!skipRef && value) ref(() => value, node);
440
475
  return value;
@@ -517,21 +552,22 @@ function eventHandler(e) {
517
552
  function insertExpression(parent, value, current, marker) {
518
553
  if (isHydrating(parent)) return;
519
554
  if (value === current) return;
555
+ const childRoot = getChildRoot(parent);
520
556
  const t = typeof value,
521
557
  multi = marker !== undefined;
522
558
  if (t === "string" || t === "number") {
523
559
  const tc = typeof current;
524
560
  if (tc === "string" || tc === "number") {
525
- parent.firstChild.data = value;
526
- } else parent.textContent = value;
561
+ childRoot.firstChild.data = value;
562
+ } else childRoot.textContent = value;
527
563
  } else if (value === undefined) {
528
564
  cleanChildren(parent, current, marker);
529
565
  } else if (value.nodeType) {
530
566
  if (Array.isArray(current)) {
531
567
  cleanChildren(parent, current, multi ? marker : null, value);
532
- } else if (current === undefined || !parent.firstChild) {
533
- parent.appendChild(value);
534
- } else parent.replaceChild(value, parent.firstChild);
568
+ } else if (current === undefined || !childRoot.firstChild) {
569
+ childRoot.appendChild(value);
570
+ } else childRoot.replaceChild(value, childRoot.firstChild);
535
571
  } else if (Array.isArray(value)) {
536
572
  const currentArray = current && Array.isArray(current);
537
573
  if (value.length === 0) {
@@ -539,7 +575,7 @@ function insertExpression(parent, value, current, marker) {
539
575
  } else if (currentArray) {
540
576
  if (current.length === 0) {
541
577
  appendNodes(parent, value, marker);
542
- } else reconcileArrays(parent, current, value);
578
+ } else reconcileArrays(childRoot, current, value);
543
579
  } else {
544
580
  current && cleanChildren(parent);
545
581
  appendNodes(parent, value);
@@ -564,9 +600,11 @@ function normalize(value, current, multi, doNotUnwrap) {
564
600
  return value;
565
601
  }
566
602
  function appendNodes(parent, array, marker = null) {
603
+ parent = getChildRoot(parent);
567
604
  for (let i = 0, len = array.length; i < len; i++) parent.insertBefore(array[i], marker);
568
605
  }
569
606
  function cleanChildren(parent, current, marker, replacement) {
607
+ parent = getChildRoot(parent);
570
608
  if (marker === undefined) return parent.textContent = "";
571
609
  if (current.length) {
572
610
  let inserted = false;
@@ -621,9 +659,8 @@ function render(...args) {
621
659
  }
622
660
  const isServer = false;
623
661
  const isDev = false;
624
- const SVG_NAMESPACE = "http://www.w3.org/2000/svg";
625
- function createElement(tagName, isSVG = false, is = undefined) {
626
- return isSVG ? document.createElementNS(SVG_NAMESPACE, tagName) : document.createElement(tagName, {
662
+ function createElement(tagName, is = undefined) {
663
+ return SVGElements.has(tagName) ? document.createElementNS(Namespaces.svg, tagName) : MathMLElements.has(tagName) ? document.createElementNS(Namespaces.mathml, tagName) : document.createElement(tagName, {
627
664
  is
628
665
  });
629
666
  }
@@ -676,9 +713,8 @@ function createDynamic(component, props) {
676
713
  case "function":
677
714
  return untrack(() => component(props));
678
715
  case "string":
679
- const isSvg = SVGElements.has(component);
680
- const el = sharedConfig.hydrating ? getNextElement() : createElement(component, isSvg, untrack(() => props.is));
681
- spread(el, props, isSvg);
716
+ const el = sharedConfig.hydrating ? getNextElement() : createElement(component, untrack(() => props.is));
717
+ spread(el, props);
682
718
  return el;
683
719
  }
684
720
  });