@vue/runtime-dom 3.2.24 → 3.2.28

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.
@@ -7,7 +7,7 @@ var shared = require('@vue/shared');
7
7
 
8
8
  const svgNS = 'http://www.w3.org/2000/svg';
9
9
  const doc = (typeof document !== 'undefined' ? document : null);
10
- const staticTemplateCache = new Map();
10
+ const templateContainer = doc && doc.createElement('template');
11
11
  const nodeOps = {
12
12
  insert: (child, parent, anchor) => {
13
13
  parent.insertBefore(child, anchor || null);
@@ -61,14 +61,21 @@ const nodeOps = {
61
61
  // Reason: innerHTML.
62
62
  // Static content here can only come from compiled templates.
63
63
  // As long as the user only uses trusted templates, this is safe.
64
- insertStaticContent(content, parent, anchor, isSVG) {
64
+ insertStaticContent(content, parent, anchor, isSVG, start, end) {
65
65
  // <parent> before | first ... last | anchor </parent>
66
66
  const before = anchor ? anchor.previousSibling : parent.lastChild;
67
- let template = staticTemplateCache.get(content);
68
- if (!template) {
69
- const t = doc.createElement('template');
70
- t.innerHTML = isSVG ? `<svg>${content}</svg>` : content;
71
- template = t.content;
67
+ if (start && end) {
68
+ // cached
69
+ while (true) {
70
+ parent.insertBefore(start.cloneNode(true), anchor);
71
+ if (start === end || !(start = start.nextSibling))
72
+ break;
73
+ }
74
+ }
75
+ else {
76
+ // fresh insert
77
+ templateContainer.innerHTML = isSVG ? `<svg>${content}</svg>` : content;
78
+ const template = templateContainer.content;
72
79
  if (isSVG) {
73
80
  // remove outer svg wrapper
74
81
  const wrapper = template.firstChild;
@@ -77,9 +84,8 @@ const nodeOps = {
77
84
  }
78
85
  template.removeChild(wrapper);
79
86
  }
80
- staticTemplateCache.set(content, template);
87
+ parent.insertBefore(template, anchor);
81
88
  }
82
- parent.insertBefore(template.cloneNode(true), anchor);
83
89
  return [
84
90
  // first
85
91
  before ? before.nextSibling : parent.firstChild,
@@ -371,7 +377,7 @@ function patchStopImmediatePropagation(e, value) {
371
377
  originalStop.call(e);
372
378
  e._stopped = true;
373
379
  };
374
- return value.map(fn => (e) => !e._stopped && fn(e));
380
+ return value.map(fn => (e) => !e._stopped && fn && fn(e));
375
381
  }
376
382
  else {
377
383
  return value;
@@ -7,7 +7,7 @@ var shared = require('@vue/shared');
7
7
 
8
8
  const svgNS = 'http://www.w3.org/2000/svg';
9
9
  const doc = (typeof document !== 'undefined' ? document : null);
10
- const staticTemplateCache = new Map();
10
+ const templateContainer = doc && doc.createElement('template');
11
11
  const nodeOps = {
12
12
  insert: (child, parent, anchor) => {
13
13
  parent.insertBefore(child, anchor || null);
@@ -61,14 +61,21 @@ const nodeOps = {
61
61
  // Reason: innerHTML.
62
62
  // Static content here can only come from compiled templates.
63
63
  // As long as the user only uses trusted templates, this is safe.
64
- insertStaticContent(content, parent, anchor, isSVG) {
64
+ insertStaticContent(content, parent, anchor, isSVG, start, end) {
65
65
  // <parent> before | first ... last | anchor </parent>
66
66
  const before = anchor ? anchor.previousSibling : parent.lastChild;
67
- let template = staticTemplateCache.get(content);
68
- if (!template) {
69
- const t = doc.createElement('template');
70
- t.innerHTML = isSVG ? `<svg>${content}</svg>` : content;
71
- template = t.content;
67
+ if (start && end) {
68
+ // cached
69
+ while (true) {
70
+ parent.insertBefore(start.cloneNode(true), anchor);
71
+ if (start === end || !(start = start.nextSibling))
72
+ break;
73
+ }
74
+ }
75
+ else {
76
+ // fresh insert
77
+ templateContainer.innerHTML = isSVG ? `<svg>${content}</svg>` : content;
78
+ const template = templateContainer.content;
72
79
  if (isSVG) {
73
80
  // remove outer svg wrapper
74
81
  const wrapper = template.firstChild;
@@ -77,9 +84,8 @@ const nodeOps = {
77
84
  }
78
85
  template.removeChild(wrapper);
79
86
  }
80
- staticTemplateCache.set(content, template);
87
+ parent.insertBefore(template, anchor);
81
88
  }
82
- parent.insertBefore(template.cloneNode(true), anchor);
83
89
  return [
84
90
  // first
85
91
  before ? before.nextSibling : parent.firstChild,
@@ -367,7 +373,7 @@ function patchStopImmediatePropagation(e, value) {
367
373
  originalStop.call(e);
368
374
  e._stopped = true;
369
375
  };
370
- return value.map(fn => (e) => !e._stopped && fn(e));
376
+ return value.map(fn => (e) => !e._stopped && fn && fn(e));
371
377
  }
372
378
  else {
373
379
  return value;
@@ -1480,6 +1480,8 @@ type ReservedProps = {
1480
1480
  | string
1481
1481
  | RuntimeCore.Ref
1482
1482
  | ((ref: Element | RuntimeCore.ComponentPublicInstance | null) => void)
1483
+ ref_for?: boolean
1484
+ ref_key?: string
1483
1485
  }
1484
1486
 
1485
1487
  type ElementAttrs<T> = T & ReservedProps