@fictjs/runtime 0.10.0 → 0.12.0

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.
Files changed (72) hide show
  1. package/dist/advanced.cjs +9 -9
  2. package/dist/advanced.d.cts +3 -3
  3. package/dist/advanced.d.ts +3 -3
  4. package/dist/advanced.js +4 -4
  5. package/dist/{binding-DqxS9ZQf.d.ts → binding-DcnhUSQK.d.ts} +1 -1
  6. package/dist/{binding-DUEukRxl.d.cts → binding-FRyTeLDn.d.cts} +1 -1
  7. package/dist/{chunk-DKA2I6ET.js → chunk-2UR2UWE2.js} +3 -3
  8. package/dist/{chunk-SZLJCQFZ.cjs → chunk-44EQF3AR.cjs} +63 -52
  9. package/dist/chunk-44EQF3AR.cjs.map +1 -0
  10. package/dist/{chunk-I4GKKAAY.cjs → chunk-4QGEN5SJ.cjs} +295 -262
  11. package/dist/chunk-4QGEN5SJ.cjs.map +1 -0
  12. package/dist/{chunk-V7BC64W2.cjs → chunk-C5IE4WUG.cjs} +8 -8
  13. package/dist/{chunk-V7BC64W2.cjs.map → chunk-C5IE4WUG.cjs.map} +1 -1
  14. package/dist/{chunk-F4RVNXOL.js → chunk-DIK33H5U.js} +8 -2
  15. package/dist/chunk-DIK33H5U.js.map +1 -0
  16. package/dist/{chunk-2JRPPCG7.js → chunk-FESAXMHT.js} +7 -6
  17. package/dist/{chunk-2JRPPCG7.js.map → chunk-FESAXMHT.js.map} +1 -1
  18. package/dist/chunk-FHQZCAAK.cjs +112 -0
  19. package/dist/chunk-FHQZCAAK.cjs.map +1 -0
  20. package/dist/{chunk-EQ5E4WOV.cjs → chunk-QNMYVXRL.cjs} +44 -38
  21. package/dist/chunk-QNMYVXRL.cjs.map +1 -0
  22. package/dist/{chunk-P4TZLFV6.js → chunk-S63VBIWN.js} +27 -16
  23. package/dist/chunk-S63VBIWN.js.map +1 -0
  24. package/dist/{chunk-R6FINS25.js → chunk-WIHNVN6L.js} +106 -73
  25. package/dist/chunk-WIHNVN6L.js.map +1 -0
  26. package/dist/{devtools-CMxlJUTx.d.cts → devtools-BtIkN77t.d.cts} +1 -1
  27. package/dist/{devtools-C4Hgfa-S.d.ts → devtools-D2z4llpA.d.ts} +1 -1
  28. package/dist/index.cjs +60 -58
  29. package/dist/index.cjs.map +1 -1
  30. package/dist/index.d.cts +4 -4
  31. package/dist/index.d.ts +4 -4
  32. package/dist/index.dev.js +72 -51
  33. package/dist/index.dev.js.map +1 -1
  34. package/dist/index.js +13 -11
  35. package/dist/index.js.map +1 -1
  36. package/dist/internal-list.cjs +4 -4
  37. package/dist/internal-list.d.cts +1 -1
  38. package/dist/internal-list.d.ts +1 -1
  39. package/dist/internal-list.js +3 -3
  40. package/dist/internal.cjs +5 -5
  41. package/dist/internal.d.cts +4 -4
  42. package/dist/internal.d.ts +4 -4
  43. package/dist/internal.js +4 -4
  44. package/dist/{list-BBzsJhrm.d.ts → list-BKM6YOPq.d.ts} +1 -1
  45. package/dist/{list-_NJCcjl1.d.cts → list-Bi8dDF8Q.d.cts} +1 -1
  46. package/dist/loader.cjs +28 -26
  47. package/dist/loader.cjs.map +1 -1
  48. package/dist/loader.js +11 -9
  49. package/dist/loader.js.map +1 -1
  50. package/dist/{props--zJ4ebbT.d.cts → props-9chMyBGb.d.cts} +1 -1
  51. package/dist/{props-BAGR7j-j.d.ts → props-D1nj2p_3.d.ts} +1 -1
  52. package/dist/{scope-CuImnvh1.d.ts → scope-BSkhJr0a.d.ts} +1 -1
  53. package/dist/{scope-Dq5hOu7c.d.cts → scope-Bn3sxem5.d.cts} +1 -1
  54. package/package.json +1 -1
  55. package/src/binding.ts +59 -29
  56. package/src/context.ts +4 -3
  57. package/src/dom.ts +65 -39
  58. package/src/error-boundary.ts +5 -5
  59. package/src/lifecycle.ts +8 -1
  60. package/src/list-helpers.ts +30 -13
  61. package/src/loader.ts +10 -8
  62. package/src/node-ops.ts +8 -5
  63. package/src/suspense.ts +5 -4
  64. package/dist/chunk-EQ5E4WOV.cjs.map +0 -1
  65. package/dist/chunk-F4RVNXOL.js.map +0 -1
  66. package/dist/chunk-I4GKKAAY.cjs.map +0 -1
  67. package/dist/chunk-K3DH5SD5.cjs +0 -111
  68. package/dist/chunk-K3DH5SD5.cjs.map +0 -1
  69. package/dist/chunk-P4TZLFV6.js.map +0 -1
  70. package/dist/chunk-R6FINS25.js.map +0 -1
  71. package/dist/chunk-SZLJCQFZ.cjs.map +0 -1
  72. /package/dist/{chunk-DKA2I6ET.js.map → chunk-2UR2UWE2.js.map} +0 -0
package/dist/index.dev.js CHANGED
@@ -207,7 +207,13 @@ function setRootSuspendDevtools(root, suspended) {
207
207
  hook?.rootSuspend?.(id, suspended);
208
208
  }
209
209
  function createRootContext(parent) {
210
- const root = { parent, cleanups: [], destroyCallbacks: [], suspended: false };
210
+ const root = {
211
+ parent,
212
+ ownerDocument: parent?.ownerDocument,
213
+ cleanups: [],
214
+ destroyCallbacks: [],
215
+ suspended: false
216
+ };
211
217
  registerRootDevtools(root);
212
218
  return root;
213
219
  }
@@ -1926,7 +1932,7 @@ function withHydration(root, fn) {
1926
1932
  }
1927
1933
 
1928
1934
  // src/node-ops.ts
1929
- function toNodeArray(node) {
1935
+ function toNodeArray(node, ownerDocument = document) {
1930
1936
  try {
1931
1937
  if (Array.isArray(node)) {
1932
1938
  let allNodes = true;
@@ -1947,7 +1953,7 @@ function toNodeArray(node) {
1947
1953
  }
1948
1954
  const result = [];
1949
1955
  for (const item of node) {
1950
- result.push(...toNodeArray(item));
1956
+ result.push(...toNodeArray(item, ownerDocument));
1951
1957
  }
1952
1958
  return result;
1953
1959
  }
@@ -1974,14 +1980,14 @@ function toNodeArray(node) {
1974
1980
  }
1975
1981
  try {
1976
1982
  if (typeof node === "object" && node !== null && "marker" in node) {
1977
- return toNodeArray(node.marker);
1983
+ return toNodeArray(node.marker, ownerDocument);
1978
1984
  }
1979
1985
  } catch {
1980
1986
  }
1981
1987
  try {
1982
- return [document.createTextNode(String(node))];
1988
+ return [ownerDocument.createTextNode(String(node))];
1983
1989
  } catch {
1984
- return [document.createTextNode("")];
1990
+ return [ownerDocument.createTextNode("")];
1985
1991
  }
1986
1992
  }
1987
1993
  function insertNodesBefore(parent, nodes, anchor) {
@@ -2351,7 +2357,7 @@ function applyClass(el, value, prev) {
2351
2357
  return prevState;
2352
2358
  }
2353
2359
  function createChildBinding(parent, getValue, createElementFn) {
2354
- const marker = document.createComment("fict:child");
2360
+ const marker = (parent.ownerDocument ?? document).createComment("fict:child");
2355
2361
  parent.appendChild(marker);
2356
2362
  const hostRoot = getCurrentRoot();
2357
2363
  const dispose = createRenderEffect(() => {
@@ -2365,7 +2371,7 @@ function createChildBinding(parent, getValue, createElementFn) {
2365
2371
  return;
2366
2372
  }
2367
2373
  const output = createElementFn(value);
2368
- nodes = toNodeArray(output);
2374
+ nodes = toNodeArray(output, marker.ownerDocument ?? parent.ownerDocument ?? document);
2369
2375
  const parentNode = marker.parentNode;
2370
2376
  if (parentNode) {
2371
2377
  insertNodesBefore(parentNode, nodes, marker);
@@ -2474,7 +2480,7 @@ function globalEventHandler(e) {
2474
2480
  Object.defineProperty(e, "currentTarget", {
2475
2481
  configurable: true,
2476
2482
  get() {
2477
- return node || document;
2483
+ return node || oriCurrentTarget || asNode(oriTarget)?.ownerDocument || document;
2478
2484
  }
2479
2485
  });
2480
2486
  if (e.composedPath) {
@@ -2542,7 +2548,8 @@ function bindEvent(el, eventName, handler, options2) {
2542
2548
  }
2543
2549
  function createPortal(container, render2, createElementFn) {
2544
2550
  const parentRoot = getCurrentRoot();
2545
- const marker = document.createComment("fict:portal");
2551
+ const markerOwnerDocument = container.ownerDocument ?? document;
2552
+ const marker = markerOwnerDocument.createComment("fict:portal");
2546
2553
  container.appendChild(marker);
2547
2554
  let currentNodes = [];
2548
2555
  let currentRoot2 = null;
@@ -2556,13 +2563,14 @@ function createPortal(container, render2, createElementFn) {
2556
2563
  currentNodes = [];
2557
2564
  }
2558
2565
  const root = createRootContext(parentRoot);
2566
+ root.ownerDocument = container.ownerDocument ?? parentRoot?.ownerDocument ?? document;
2559
2567
  const prev = pushRoot(root);
2560
2568
  let handledError = false;
2561
2569
  try {
2562
2570
  const output = render2();
2563
2571
  if (output != null && output !== false) {
2564
2572
  const el = createElementFn(output);
2565
- const nodes = toNodeArray(el);
2573
+ const nodes = toNodeArray(el, markerOwnerDocument);
2566
2574
  if (marker.parentNode) {
2567
2575
  insertNodesBefore(marker.parentNode, nodes, marker);
2568
2576
  }
@@ -2844,6 +2852,7 @@ function annotateComponentElements(elements, componentId, componentName) {
2844
2852
  }
2845
2853
  function render(view, container) {
2846
2854
  const root = createRootContext();
2855
+ root.ownerDocument = container.ownerDocument ?? document;
2847
2856
  const prev = pushRoot(root);
2848
2857
  let dom = void 0;
2849
2858
  try {
@@ -2870,7 +2879,7 @@ function render(view, container) {
2870
2879
  return teardown;
2871
2880
  }
2872
2881
  function createElement(node) {
2873
- return createElementWithContext(node, null);
2882
+ return createElementWithContext(node, null, resolveOwnerDocument());
2874
2883
  }
2875
2884
  function resolveNamespace(tagName, namespace) {
2876
2885
  if (tagName === "svg") return "svg";
@@ -2880,22 +2889,25 @@ function resolveNamespace(tagName, namespace) {
2880
2889
  if (isDev7 && SVGElements.has(tagName)) return "svg";
2881
2890
  return null;
2882
2891
  }
2883
- function createElementWithContext(node, namespace) {
2892
+ function resolveOwnerDocument(ownerDocument) {
2893
+ return ownerDocument ?? getCurrentRoot()?.ownerDocument ?? document;
2894
+ }
2895
+ function createElementWithContext(node, namespace, ownerDocument) {
2884
2896
  if (node instanceof Node) {
2885
2897
  return node;
2886
2898
  }
2887
2899
  if (node === null || node === void 0 || node === false) {
2888
- return document.createTextNode("");
2900
+ return ownerDocument.createTextNode("");
2889
2901
  }
2890
2902
  if (isReactive(node)) {
2891
2903
  const resolved = node();
2892
2904
  if (resolved === node) {
2893
- return document.createTextNode("");
2905
+ return ownerDocument.createTextNode("");
2894
2906
  }
2895
- return createElementWithContext(resolved, namespace);
2907
+ return createElementWithContext(resolved, namespace, ownerDocument);
2896
2908
  }
2897
2909
  if (typeof node === "function") {
2898
- return document.createTextNode("");
2910
+ return ownerDocument.createTextNode("");
2899
2911
  }
2900
2912
  if (typeof node === "object" && node !== null && !(node instanceof Node)) {
2901
2913
  if ("marker" in node) {
@@ -2911,21 +2923,21 @@ function createElementWithContext(node, namespace) {
2911
2923
  Promise.resolve().then(runFlush).catch(() => void 0);
2912
2924
  }
2913
2925
  }
2914
- return createElement(handle.marker);
2926
+ return createElementWithContext(handle.marker, namespace, ownerDocument);
2915
2927
  }
2916
2928
  }
2917
2929
  if (Array.isArray(node)) {
2918
- const frag = document.createDocumentFragment();
2930
+ const frag = ownerDocument.createDocumentFragment();
2919
2931
  for (const child of node) {
2920
- appendChildNode(frag, child, namespace);
2932
+ appendChildNode(frag, child, namespace, ownerDocument);
2921
2933
  }
2922
2934
  return frag;
2923
2935
  }
2924
2936
  if (typeof node === "string" || typeof node === "number") {
2925
- return document.createTextNode(String(node));
2937
+ return ownerDocument.createTextNode(String(node));
2926
2938
  }
2927
2939
  if (typeof node === "boolean") {
2928
- return document.createTextNode("");
2940
+ return ownerDocument.createTextNode("");
2929
2941
  }
2930
2942
  const vnode = node;
2931
2943
  if (typeof vnode.type === "function") {
@@ -2979,8 +2991,8 @@ function createElementWithContext(node, namespace) {
2979
2991
  onCleanup(() => hook.componentUnmount?.(componentId));
2980
2992
  }
2981
2993
  if (__fictIsResumable() && !__fictIsHydrating()) {
2982
- const content = createElementWithContext(rendered, namespace);
2983
- const host = namespace === "svg" ? document.createElementNS(SVG_NS, "fict-host") : namespace === "mathml" ? document.createElementNS(MATHML_NS, "fict-host") : document.createElement("fict-host");
2994
+ const content = createElementWithContext(rendered, namespace, ownerDocument);
2995
+ const host = namespace === "svg" ? ownerDocument.createElementNS(SVG_NS, "fict-host") : namespace === "mathml" ? ownerDocument.createElementNS(MATHML_NS, "fict-host") : ownerDocument.createElement("fict-host");
2984
2996
  host.setAttribute("data-fict-host", "");
2985
2997
  if (namespace === null && host.style) {
2986
2998
  ;
@@ -3003,7 +3015,7 @@ function createElementWithContext(node, namespace) {
3003
3015
  }
3004
3016
  return host;
3005
3017
  }
3006
- const componentRoot = createElementWithContext(rendered, namespace);
3018
+ const componentRoot = createElementWithContext(rendered, namespace, ownerDocument);
3007
3019
  if (hook && componentId !== void 0) {
3008
3020
  mountElements = collectComponentMountElements(componentRoot);
3009
3021
  annotateComponentElements(mountElements, componentId, componentName);
@@ -3011,7 +3023,7 @@ function createElementWithContext(node, namespace) {
3011
3023
  return componentRoot;
3012
3024
  } catch (err) {
3013
3025
  if (handleSuspend(err)) {
3014
- return document.createComment("fict:suspend");
3026
+ return ownerDocument.createComment("fict:suspend");
3015
3027
  }
3016
3028
  handleError(err, { source: "render", componentName: vnode.type.name });
3017
3029
  throw err;
@@ -3020,58 +3032,64 @@ function createElementWithContext(node, namespace) {
3020
3032
  }
3021
3033
  }
3022
3034
  if (vnode.type === Fragment) {
3023
- const frag = document.createDocumentFragment();
3035
+ const frag = ownerDocument.createDocumentFragment();
3024
3036
  const children = vnode.props?.children;
3025
- appendChildren(frag, children, namespace);
3037
+ appendChildren(frag, children, namespace, ownerDocument);
3026
3038
  return frag;
3027
3039
  }
3028
3040
  const tagName = typeof vnode.type === "string" ? vnode.type : "div";
3029
3041
  const resolvedNamespace = resolveNamespace(tagName, namespace);
3030
- const el = resolvedNamespace === "svg" ? document.createElementNS(SVG_NS, tagName) : resolvedNamespace === "mathml" ? document.createElementNS(MATHML_NS, tagName) : document.createElement(tagName);
3042
+ const el = resolvedNamespace === "svg" ? ownerDocument.createElementNS(SVG_NS, tagName) : resolvedNamespace === "mathml" ? ownerDocument.createElementNS(MATHML_NS, tagName) : ownerDocument.createElement(tagName);
3031
3043
  applyProps(el, vnode.props ?? {}, resolvedNamespace === "svg");
3032
3044
  appendChildren(
3033
3045
  el,
3034
3046
  vnode.props?.children,
3035
- tagName === "foreignObject" ? null : resolvedNamespace
3047
+ tagName === "foreignObject" ? null : resolvedNamespace,
3048
+ ownerDocument
3036
3049
  );
3037
3050
  return el;
3038
3051
  }
3039
3052
  function isBindingHandle(node) {
3040
3053
  return node !== null && typeof node === "object" && "marker" in node && "dispose" in node && typeof node.dispose === "function";
3041
3054
  }
3042
- function appendChildNode(parent, child, namespace) {
3055
+ function appendChildNode(parent, child, namespace, ownerDocument) {
3056
+ const parentOwnerDocument = parent.ownerDocument ?? ownerDocument;
3043
3057
  if (child === null || child === void 0 || child === false) {
3044
3058
  return;
3045
3059
  }
3046
3060
  if (isBindingHandle(child)) {
3047
- appendChildNode(parent, child.marker, namespace);
3061
+ appendChildNode(parent, child.marker, namespace, parentOwnerDocument);
3048
3062
  child.flush?.();
3049
3063
  return;
3050
3064
  }
3051
3065
  if (typeof child === "function") {
3052
3066
  const childGetter = child;
3053
3067
  if (isReactive(childGetter)) {
3054
- createChildBinding(parent, childGetter, (node) => createElementWithContext(node, namespace));
3068
+ createChildBinding(
3069
+ parent,
3070
+ childGetter,
3071
+ (node) => createElementWithContext(node, namespace, parentOwnerDocument)
3072
+ );
3055
3073
  return;
3056
3074
  }
3057
3075
  return;
3058
3076
  }
3059
3077
  if (Array.isArray(child)) {
3060
3078
  for (const item of child) {
3061
- appendChildNode(parent, item, namespace);
3079
+ appendChildNode(parent, item, namespace, parentOwnerDocument);
3062
3080
  }
3063
3081
  return;
3064
3082
  }
3065
3083
  let domNode;
3066
3084
  if (typeof child !== "object" || child === null) {
3067
- domNode = document.createTextNode(String(child ?? ""));
3085
+ domNode = parentOwnerDocument.createTextNode(String(child ?? ""));
3068
3086
  } else {
3069
- domNode = createElementWithContext(child, namespace);
3087
+ domNode = createElementWithContext(child, namespace, parentOwnerDocument);
3070
3088
  }
3071
3089
  if (domNode.nodeType === 11) {
3072
3090
  const children = Array.from(domNode.childNodes);
3073
3091
  for (const node of children) {
3074
- appendChildNode(parent, node, namespace);
3092
+ appendChildNode(parent, node, namespace, parentOwnerDocument);
3075
3093
  }
3076
3094
  return;
3077
3095
  }
@@ -3089,15 +3107,15 @@ function appendChildNode(parent, child, namespace) {
3089
3107
  throw e;
3090
3108
  }
3091
3109
  }
3092
- function appendChildren(parent, children, namespace) {
3110
+ function appendChildren(parent, children, namespace, ownerDocument) {
3093
3111
  if (children === void 0) return;
3094
3112
  if (Array.isArray(children)) {
3095
3113
  for (const child of children) {
3096
- appendChildren(parent, child, namespace);
3114
+ appendChildren(parent, child, namespace, ownerDocument);
3097
3115
  }
3098
3116
  return;
3099
3117
  }
3100
- appendChildNode(parent, children, namespace);
3118
+ appendChildNode(parent, children, namespace, ownerDocument);
3101
3119
  }
3102
3120
  function applyRef(el, value) {
3103
3121
  if (typeof value === "function") {
@@ -3313,10 +3331,11 @@ function eventNameFromProp(key) {
3313
3331
 
3314
3332
  // src/error-boundary.ts
3315
3333
  function ErrorBoundary(props) {
3316
- const fragment = document.createDocumentFragment();
3317
- const marker = document.createComment("fict:error-boundary");
3318
- fragment.appendChild(marker);
3319
3334
  const hostRoot = getCurrentRoot();
3335
+ const markerOwnerDocument = hostRoot?.ownerDocument ?? document;
3336
+ const fragment = markerOwnerDocument.createDocumentFragment();
3337
+ const marker = markerOwnerDocument.createComment("fict:error-boundary");
3338
+ fragment.appendChild(marker);
3320
3339
  let cleanup;
3321
3340
  let activeNodes = [];
3322
3341
  let renderingFallback = false;
@@ -3345,7 +3364,7 @@ function ErrorBoundary(props) {
3345
3364
  let nodes = [];
3346
3365
  try {
3347
3366
  const output = createElement(value);
3348
- nodes = toNodeArray(output);
3367
+ nodes = toNodeArray(output, markerOwnerDocument);
3349
3368
  const parentNode = marker.parentNode;
3350
3369
  if (parentNode) {
3351
3370
  insertNodesBefore(parentNode, nodes, marker);
@@ -3423,6 +3442,7 @@ function Suspense(props) {
3423
3442
  let resolvedOnce = false;
3424
3443
  let epoch = 0;
3425
3444
  const hostRoot = getCurrentRoot();
3445
+ const markerOwnerDocument = hostRoot?.ownerDocument ?? document;
3426
3446
  const toFallback = (err) => typeof props.fallback === "function" ? props.fallback(err) : props.fallback;
3427
3447
  const renderView = (view) => {
3428
3448
  if (cleanup) {
@@ -3446,7 +3466,7 @@ function Suspense(props) {
3446
3466
  boundaryPushed = true;
3447
3467
  }
3448
3468
  const output = createElement(view);
3449
- nodes = toNodeArray(output);
3469
+ nodes = toNodeArray(output, markerOwnerDocument);
3450
3470
  const suspendedAttempt = root.suspended || nodes.length > 0 && nodes.every((node) => node instanceof Comment && node.data === "fict:suspend");
3451
3471
  if (suspendedAttempt) {
3452
3472
  popRoot(prev);
@@ -3477,9 +3497,9 @@ function Suspense(props) {
3477
3497
  };
3478
3498
  activeNodes = nodes;
3479
3499
  };
3480
- const fragment = document.createDocumentFragment();
3481
- const startMarker = document.createComment("fict:suspense-start");
3482
- const endMarker = document.createComment("fict:suspense-end");
3500
+ const fragment = markerOwnerDocument.createDocumentFragment();
3501
+ const startMarker = markerOwnerDocument.createComment("fict:suspense-start");
3502
+ const endMarker = markerOwnerDocument.createComment("fict:suspense-end");
3483
3503
  fragment.appendChild(startMarker);
3484
3504
  fragment.appendChild(endMarker);
3485
3505
  let cleanup;
@@ -3599,8 +3619,9 @@ function createContext(defaultValue) {
3599
3619
  const providerRoot = createRootContext(hostRoot);
3600
3620
  const contextMap = getContextMap(providerRoot);
3601
3621
  contextMap.set(id, props.value);
3602
- const fragment = document.createDocumentFragment();
3603
- const marker = document.createComment("fict:ctx");
3622
+ const markerOwnerDocument = providerRoot.ownerDocument ?? hostRoot?.ownerDocument ?? document;
3623
+ const fragment = markerOwnerDocument.createDocumentFragment();
3624
+ const marker = markerOwnerDocument.createComment("fict:ctx");
3604
3625
  fragment.appendChild(marker);
3605
3626
  let cleanup;
3606
3627
  let activeNodes = [];
@@ -3620,7 +3641,7 @@ function createContext(defaultValue) {
3620
3641
  let nodes = [];
3621
3642
  try {
3622
3643
  const output = createElement(children);
3623
- nodes = toNodeArray(output);
3644
+ nodes = toNodeArray(output, markerOwnerDocument);
3624
3645
  const parentNode = marker.parentNode;
3625
3646
  if (parentNode) {
3626
3647
  insertNodesBefore(parentNode, nodes, marker);