@vue/runtime-dom 3.2.23 → 3.2.27

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,
@@ -621,7 +627,7 @@ class VueElement extends BaseClass {
621
627
  // HMR
622
628
  {
623
629
  instance.ceReload = newStyles => {
624
- // alawys reset styles
630
+ // always reset styles
625
631
  if (this._styles) {
626
632
  this._styles.forEach(s => this.shadowRoot.removeChild(s));
627
633
  this._styles.length = 0;
@@ -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,
@@ -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