@vue/runtime-dom 3.2.20 → 3.2.24

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.
@@ -112,16 +112,8 @@ function patchClass(el, value, isSVG) {
112
112
 
113
113
  function patchStyle(el, prev, next) {
114
114
  const style = el.style;
115
- const currentDisplay = style.display;
116
- if (!next) {
117
- el.removeAttribute('style');
118
- }
119
- else if (shared.isString(next)) {
120
- if (prev !== next) {
121
- style.cssText = next;
122
- }
123
- }
124
- else {
115
+ const isCssString = shared.isString(next);
116
+ if (next && !isCssString) {
125
117
  for (const key in next) {
126
118
  setStyle(style, key, next[key]);
127
119
  }
@@ -133,11 +125,22 @@ function patchStyle(el, prev, next) {
133
125
  }
134
126
  }
135
127
  }
136
- // indicates that the `display` of the element is controlled by `v-show`,
137
- // so we always keep the current `display` value regardless of the `style` value,
138
- // thus handing over control to `v-show`.
139
- if ('_vod' in el) {
140
- style.display = currentDisplay;
128
+ else {
129
+ const currentDisplay = style.display;
130
+ if (isCssString) {
131
+ if (prev !== next) {
132
+ style.cssText = next;
133
+ }
134
+ }
135
+ else if (prev) {
136
+ el.removeAttribute('style');
137
+ }
138
+ // indicates that the `display` of the element is controlled by `v-show`,
139
+ // so we always keep the current `display` value regardless of the `style`
140
+ // value, thus handing over control to `v-show`.
141
+ if ('_vod' in el) {
142
+ style.display = currentDisplay;
143
+ }
141
144
  }
142
145
  }
143
146
  const importantRE = /\s*!important$/;
@@ -220,12 +223,19 @@ prevChildren, parentComponent, parentSuspense, unmountChildren) {
220
223
  el[key] = value == null ? '' : value;
221
224
  return;
222
225
  }
223
- if (key === 'value' && el.tagName !== 'PROGRESS') {
226
+ if (key === 'value' &&
227
+ el.tagName !== 'PROGRESS' &&
228
+ // custom elements may use _value internally
229
+ !el.tagName.includes('-')) {
224
230
  // store value as _value as well since
225
231
  // non-string values will be stringified.
226
232
  el._value = value;
227
233
  const newValue = value == null ? '' : value;
228
- if (el.value !== newValue) {
234
+ if (el.value !== newValue ||
235
+ // #4956: always set for OPTION elements because its value falls back to
236
+ // textContent if no value attribute is present. And setting .value for
237
+ // OPTION has no side effect
238
+ el.tagName === 'OPTION') {
229
239
  el.value = newValue;
230
240
  }
231
241
  if (value == null) {
@@ -483,22 +493,11 @@ class VueElement extends BaseClass {
483
493
  }
484
494
  this.attachShadow({ mode: 'open' });
485
495
  }
486
- // set initial attrs
487
- for (let i = 0; i < this.attributes.length; i++) {
488
- this._setAttr(this.attributes[i].name);
489
- }
490
- // watch future attr changes
491
- new MutationObserver(mutations => {
492
- for (const m of mutations) {
493
- this._setAttr(m.attributeName);
494
- }
495
- }).observe(this, { attributes: true });
496
496
  }
497
497
  connectedCallback() {
498
498
  this._connected = true;
499
499
  if (!this._instance) {
500
500
  this._resolveDef();
501
- this._update();
502
501
  }
503
502
  }
504
503
  disconnectedCallback() {
@@ -517,8 +516,18 @@ class VueElement extends BaseClass {
517
516
  if (this._resolved) {
518
517
  return;
519
518
  }
519
+ this._resolved = true;
520
+ // set initial attrs
521
+ for (let i = 0; i < this.attributes.length; i++) {
522
+ this._setAttr(this.attributes[i].name);
523
+ }
524
+ // watch future attr changes
525
+ new MutationObserver(mutations => {
526
+ for (const m of mutations) {
527
+ this._setAttr(m.attributeName);
528
+ }
529
+ }).observe(this, { attributes: true });
520
530
  const resolve = (def) => {
521
- this._resolved = true;
522
531
  const { props, styles } = def;
523
532
  const hasOptions = !shared.isArray(props);
524
533
  const rawKeys = props ? (hasOptions ? Object.keys(props) : props) : [];
@@ -533,14 +542,11 @@ class VueElement extends BaseClass {
533
542
  }
534
543
  }
535
544
  }
536
- if (numberProps) {
537
- this._numberProps = numberProps;
538
- this._update();
539
- }
545
+ this._numberProps = numberProps;
540
546
  // check if there are props set pre-upgrade or connect
541
547
  for (const key of Object.keys(this)) {
542
548
  if (key[0] !== '_') {
543
- this._setProp(key, this[key]);
549
+ this._setProp(key, this[key], true, false);
544
550
  }
545
551
  }
546
552
  // defining getter/setters on prototype
@@ -554,7 +560,10 @@ class VueElement extends BaseClass {
554
560
  }
555
561
  });
556
562
  }
563
+ // apply CSS
557
564
  this._applyStyles(styles);
565
+ // initial render
566
+ this._update();
558
567
  };
559
568
  const asyncDef = this._def.__asyncLoader;
560
569
  if (asyncDef) {
@@ -580,10 +589,10 @@ class VueElement extends BaseClass {
580
589
  /**
581
590
  * @internal
582
591
  */
583
- _setProp(key, val, shouldReflect = true) {
592
+ _setProp(key, val, shouldReflect = true, shouldUpdate = true) {
584
593
  if (val !== this._props[key]) {
585
594
  this._props[key] = val;
586
- if (this._instance) {
595
+ if (shouldUpdate && this._instance) {
587
596
  this._update();
588
597
  }
589
598
  // reflect
@@ -612,7 +621,7 @@ class VueElement extends BaseClass {
612
621
  // HMR
613
622
  {
614
623
  instance.ceReload = newStyles => {
615
- // alawys reset styles
624
+ // always reset styles
616
625
  if (this._styles) {
617
626
  this._styles.forEach(s => this.shadowRoot.removeChild(s));
618
627
  this._styles.length = 0;
@@ -112,16 +112,8 @@ function patchClass(el, value, isSVG) {
112
112
 
113
113
  function patchStyle(el, prev, next) {
114
114
  const style = el.style;
115
- const currentDisplay = style.display;
116
- if (!next) {
117
- el.removeAttribute('style');
118
- }
119
- else if (shared.isString(next)) {
120
- if (prev !== next) {
121
- style.cssText = next;
122
- }
123
- }
124
- else {
115
+ const isCssString = shared.isString(next);
116
+ if (next && !isCssString) {
125
117
  for (const key in next) {
126
118
  setStyle(style, key, next[key]);
127
119
  }
@@ -133,11 +125,22 @@ function patchStyle(el, prev, next) {
133
125
  }
134
126
  }
135
127
  }
136
- // indicates that the `display` of the element is controlled by `v-show`,
137
- // so we always keep the current `display` value regardless of the `style` value,
138
- // thus handing over control to `v-show`.
139
- if ('_vod' in el) {
140
- style.display = currentDisplay;
128
+ else {
129
+ const currentDisplay = style.display;
130
+ if (isCssString) {
131
+ if (prev !== next) {
132
+ style.cssText = next;
133
+ }
134
+ }
135
+ else if (prev) {
136
+ el.removeAttribute('style');
137
+ }
138
+ // indicates that the `display` of the element is controlled by `v-show`,
139
+ // so we always keep the current `display` value regardless of the `style`
140
+ // value, thus handing over control to `v-show`.
141
+ if ('_vod' in el) {
142
+ style.display = currentDisplay;
143
+ }
141
144
  }
142
145
  }
143
146
  const importantRE = /\s*!important$/;
@@ -220,12 +223,19 @@ prevChildren, parentComponent, parentSuspense, unmountChildren) {
220
223
  el[key] = value == null ? '' : value;
221
224
  return;
222
225
  }
223
- if (key === 'value' && el.tagName !== 'PROGRESS') {
226
+ if (key === 'value' &&
227
+ el.tagName !== 'PROGRESS' &&
228
+ // custom elements may use _value internally
229
+ !el.tagName.includes('-')) {
224
230
  // store value as _value as well since
225
231
  // non-string values will be stringified.
226
232
  el._value = value;
227
233
  const newValue = value == null ? '' : value;
228
- if (el.value !== newValue) {
234
+ if (el.value !== newValue ||
235
+ // #4956: always set for OPTION elements because its value falls back to
236
+ // textContent if no value attribute is present. And setting .value for
237
+ // OPTION has no side effect
238
+ el.tagName === 'OPTION') {
229
239
  el.value = newValue;
230
240
  }
231
241
  if (value == null) {
@@ -475,22 +485,11 @@ class VueElement extends BaseClass {
475
485
  else {
476
486
  this.attachShadow({ mode: 'open' });
477
487
  }
478
- // set initial attrs
479
- for (let i = 0; i < this.attributes.length; i++) {
480
- this._setAttr(this.attributes[i].name);
481
- }
482
- // watch future attr changes
483
- new MutationObserver(mutations => {
484
- for (const m of mutations) {
485
- this._setAttr(m.attributeName);
486
- }
487
- }).observe(this, { attributes: true });
488
488
  }
489
489
  connectedCallback() {
490
490
  this._connected = true;
491
491
  if (!this._instance) {
492
492
  this._resolveDef();
493
- this._update();
494
493
  }
495
494
  }
496
495
  disconnectedCallback() {
@@ -509,8 +508,18 @@ class VueElement extends BaseClass {
509
508
  if (this._resolved) {
510
509
  return;
511
510
  }
511
+ this._resolved = true;
512
+ // set initial attrs
513
+ for (let i = 0; i < this.attributes.length; i++) {
514
+ this._setAttr(this.attributes[i].name);
515
+ }
516
+ // watch future attr changes
517
+ new MutationObserver(mutations => {
518
+ for (const m of mutations) {
519
+ this._setAttr(m.attributeName);
520
+ }
521
+ }).observe(this, { attributes: true });
512
522
  const resolve = (def) => {
513
- this._resolved = true;
514
523
  const { props, styles } = def;
515
524
  const hasOptions = !shared.isArray(props);
516
525
  const rawKeys = props ? (hasOptions ? Object.keys(props) : props) : [];
@@ -525,14 +534,11 @@ class VueElement extends BaseClass {
525
534
  }
526
535
  }
527
536
  }
528
- if (numberProps) {
529
- this._numberProps = numberProps;
530
- this._update();
531
- }
537
+ this._numberProps = numberProps;
532
538
  // check if there are props set pre-upgrade or connect
533
539
  for (const key of Object.keys(this)) {
534
540
  if (key[0] !== '_') {
535
- this._setProp(key, this[key]);
541
+ this._setProp(key, this[key], true, false);
536
542
  }
537
543
  }
538
544
  // defining getter/setters on prototype
@@ -546,7 +552,10 @@ class VueElement extends BaseClass {
546
552
  }
547
553
  });
548
554
  }
555
+ // apply CSS
549
556
  this._applyStyles(styles);
557
+ // initial render
558
+ this._update();
550
559
  };
551
560
  const asyncDef = this._def.__asyncLoader;
552
561
  if (asyncDef) {
@@ -572,10 +581,10 @@ class VueElement extends BaseClass {
572
581
  /**
573
582
  * @internal
574
583
  */
575
- _setProp(key, val, shouldReflect = true) {
584
+ _setProp(key, val, shouldReflect = true, shouldUpdate = true) {
576
585
  if (val !== this._props[key]) {
577
586
  this._props[key] = val;
578
- if (this._instance) {
587
+ if (shouldUpdate && this._instance) {
579
588
  this._update();
580
589
  }
581
590
  // reflect
@@ -455,7 +455,7 @@ const targetMap = new WeakMap();
455
455
  let effectTrackDepth = 0;
456
456
  let trackOpBit = 1;
457
457
  /**
458
- * The bitwise track markers support at most 30 levels op recursion.
458
+ * The bitwise track markers support at most 30 levels of recursion.
459
459
  * This value is chosen to enable modern JS engines to use a SMI on all platforms.
460
460
  * When recursion depth is greater, fall back to using a full cleanup.
461
461
  */
@@ -776,7 +776,7 @@ const shallowSet = /*#__PURE__*/ createSetter(true);
776
776
  function createSetter(shallow = false) {
777
777
  return function set(target, key, value, receiver) {
778
778
  let oldValue = target[key];
779
- if (!shallow) {
779
+ if (!shallow && !isReadonly(value)) {
780
780
  value = toRaw(value);
781
781
  oldValue = toRaw(oldValue);
782
782
  if (!isArray(target) && isRef(oldValue) && !isRef(value)) {
@@ -1572,22 +1572,33 @@ function tryWrap(fn) {
1572
1572
 
1573
1573
  let devtools;
1574
1574
  let buffer = [];
1575
+ let devtoolsNotInstalled = false;
1575
1576
  function emit(event, ...args) {
1576
1577
  if (devtools) {
1577
1578
  devtools.emit(event, ...args);
1578
1579
  }
1579
- else {
1580
+ else if (!devtoolsNotInstalled) {
1580
1581
  buffer.push({ event, args });
1581
1582
  }
1582
1583
  }
1583
1584
  function setDevtoolsHook(hook, target) {
1585
+ var _a, _b;
1584
1586
  devtools = hook;
1585
1587
  if (devtools) {
1586
1588
  devtools.enabled = true;
1587
1589
  buffer.forEach(({ event, args }) => devtools.emit(event, ...args));
1588
1590
  buffer = [];
1589
1591
  }
1590
- else {
1592
+ else if (
1593
+ // handle late devtools injection - only do this if we are in an actual
1594
+ // browser environment to avoid the timer handle stalling test runner exit
1595
+ // (#4815)
1596
+ // eslint-disable-next-line no-restricted-globals
1597
+ typeof window !== 'undefined' &&
1598
+ // some envs mock window but not fully
1599
+ window.HTMLElement &&
1600
+ // also exclude jsdom
1601
+ !((_b = (_a = window.navigator) === null || _a === void 0 ? void 0 : _a.userAgent) === null || _b === void 0 ? void 0 : _b.includes('jsdom'))) {
1591
1602
  const replay = (target.__VUE_DEVTOOLS_HOOK_REPLAY__ =
1592
1603
  target.__VUE_DEVTOOLS_HOOK_REPLAY__ || []);
1593
1604
  replay.push((newHook) => {
@@ -1596,9 +1607,18 @@ function setDevtoolsHook(hook, target) {
1596
1607
  // clear buffer after 3s - the user probably doesn't have devtools installed
1597
1608
  // at all, and keeping the buffer will cause memory leaks (#4738)
1598
1609
  setTimeout(() => {
1599
- buffer = [];
1610
+ if (!devtools) {
1611
+ target.__VUE_DEVTOOLS_HOOK_REPLAY__ = null;
1612
+ devtoolsNotInstalled = true;
1613
+ buffer = [];
1614
+ }
1600
1615
  }, 3000);
1601
1616
  }
1617
+ else {
1618
+ // non-browser env, assume not installed
1619
+ devtoolsNotInstalled = true;
1620
+ buffer = [];
1621
+ }
1602
1622
  }
1603
1623
  function devtoolsInitApp(app, version) {
1604
1624
  emit("app:init" /* APP_INIT */, app, version, {
@@ -2672,7 +2692,8 @@ const BaseTransitionImpl = {
2672
2692
  const rawProps = toRaw(props);
2673
2693
  const { mode } = rawProps;
2674
2694
  // check mode
2675
- if (mode && !['in-out', 'out-in', 'default'].includes(mode)) {
2695
+ if (mode &&
2696
+ mode !== 'in-out' && mode !== 'out-in' && mode !== 'default') {
2676
2697
  warn$1(`invalid <transition> mode: ${mode}`);
2677
2698
  }
2678
2699
  // at this point children has a guaranteed length of 1.
@@ -3312,7 +3333,7 @@ function registerKeepAliveHook(hook, type, target = currentInstance) {
3312
3333
  }
3313
3334
  current = current.parent;
3314
3335
  }
3315
- hook();
3336
+ return hook();
3316
3337
  });
3317
3338
  injectHook(type, wrappedHook, target);
3318
3339
  // In addition to registering it on the target instance, we walk up the parent
@@ -3974,7 +3995,7 @@ function setFullProps(instance, rawProps, props, attrs) {
3974
3995
  }
3975
3996
  }
3976
3997
  else if (!isEmitListener(instance.emitsOptions, key)) {
3977
- if (value !== attrs[key]) {
3998
+ if (!(key in attrs) || value !== attrs[key]) {
3978
3999
  attrs[key] = value;
3979
4000
  hasAttrsChanged = true;
3980
4001
  }
@@ -4386,7 +4407,7 @@ return withDirectives(h(comp), [
4386
4407
  [bar, this.y]
4387
4408
  ])
4388
4409
  */
4389
- const isBuiltInDirective = /*#__PURE__*/ makeMap('bind,cloak,else-if,else,for,html,if,model,on,once,pre,show,slot,text');
4410
+ const isBuiltInDirective = /*#__PURE__*/ makeMap('bind,cloak,else-if,else,for,html,if,model,on,once,pre,show,slot,text,memo');
4390
4411
  function validateDirectiveName(name) {
4391
4412
  if (isBuiltInDirective(name)) {
4392
4413
  warn$1('Do not use built-in directive ids as custom directive id: ' + name);
@@ -6303,8 +6324,8 @@ function invokeVNodeHook(hook, instance, vnode, prevVNode = null) {
6303
6324
  *
6304
6325
  * #2080
6305
6326
  * Inside keyed `template` fragment static children, if a fragment is moved,
6306
- * the children will always moved so that need inherit el form previous nodes
6307
- * to ensure correct moved position.
6327
+ * the children will always be moved. Therefore, in order to ensure correct move
6328
+ * position, el should be inherited from previous nodes.
6308
6329
  */
6309
6330
  function traverseStaticChildren(n1, n2, shallow = false) {
6310
6331
  const ch1 = n1.children;
@@ -7084,7 +7105,8 @@ function mergeProps(...args) {
7084
7105
  else if (isOn(key)) {
7085
7106
  const existing = ret[key];
7086
7107
  const incoming = toMerge[key];
7087
- if (existing !== incoming) {
7108
+ if (existing !== incoming &&
7109
+ !(isArray(existing) && existing.includes(incoming))) {
7088
7110
  ret[key] = existing
7089
7111
  ? [].concat(existing, incoming)
7090
7112
  : incoming;
@@ -7287,23 +7309,23 @@ const PublicInstanceProxyHandlers = {
7287
7309
  const n = accessCache[key];
7288
7310
  if (n !== undefined) {
7289
7311
  switch (n) {
7290
- case 0 /* SETUP */:
7312
+ case 1 /* SETUP */:
7291
7313
  return setupState[key];
7292
- case 1 /* DATA */:
7314
+ case 2 /* DATA */:
7293
7315
  return data[key];
7294
- case 3 /* CONTEXT */:
7316
+ case 4 /* CONTEXT */:
7295
7317
  return ctx[key];
7296
- case 2 /* PROPS */:
7318
+ case 3 /* PROPS */:
7297
7319
  return props[key];
7298
7320
  // default: just fallthrough
7299
7321
  }
7300
7322
  }
7301
7323
  else if (setupState !== EMPTY_OBJ && hasOwn(setupState, key)) {
7302
- accessCache[key] = 0 /* SETUP */;
7324
+ accessCache[key] = 1 /* SETUP */;
7303
7325
  return setupState[key];
7304
7326
  }
7305
7327
  else if (data !== EMPTY_OBJ && hasOwn(data, key)) {
7306
- accessCache[key] = 1 /* DATA */;
7328
+ accessCache[key] = 2 /* DATA */;
7307
7329
  return data[key];
7308
7330
  }
7309
7331
  else if (
@@ -7311,15 +7333,15 @@ const PublicInstanceProxyHandlers = {
7311
7333
  // props
7312
7334
  (normalizedProps = instance.propsOptions[0]) &&
7313
7335
  hasOwn(normalizedProps, key)) {
7314
- accessCache[key] = 2 /* PROPS */;
7336
+ accessCache[key] = 3 /* PROPS */;
7315
7337
  return props[key];
7316
7338
  }
7317
7339
  else if (ctx !== EMPTY_OBJ && hasOwn(ctx, key)) {
7318
- accessCache[key] = 3 /* CONTEXT */;
7340
+ accessCache[key] = 4 /* CONTEXT */;
7319
7341
  return ctx[key];
7320
7342
  }
7321
7343
  else if (shouldCacheAccess) {
7322
- accessCache[key] = 4 /* OTHER */;
7344
+ accessCache[key] = 0 /* OTHER */;
7323
7345
  }
7324
7346
  }
7325
7347
  const publicGetter = publicPropertiesMap[key];
@@ -7340,7 +7362,7 @@ const PublicInstanceProxyHandlers = {
7340
7362
  }
7341
7363
  else if (ctx !== EMPTY_OBJ && hasOwn(ctx, key)) {
7342
7364
  // user may set custom properties to `this` that start with `$`
7343
- accessCache[key] = 3 /* CONTEXT */;
7365
+ accessCache[key] = 4 /* CONTEXT */;
7344
7366
  return ctx[key];
7345
7367
  }
7346
7368
  else if (
@@ -7401,7 +7423,7 @@ const PublicInstanceProxyHandlers = {
7401
7423
  },
7402
7424
  has({ _: { data, setupState, accessCache, ctx, appContext, propsOptions } }, key) {
7403
7425
  let normalizedProps;
7404
- return (accessCache[key] !== undefined ||
7426
+ return (!!accessCache[key] ||
7405
7427
  (data !== EMPTY_OBJ && hasOwn(data, key)) ||
7406
7428
  (setupState !== EMPTY_OBJ && hasOwn(setupState, key)) ||
7407
7429
  ((normalizedProps = propsOptions[0]) && hasOwn(normalizedProps, key)) ||
@@ -8948,7 +8970,7 @@ function isMemoSame(cached, memo) {
8948
8970
  }
8949
8971
 
8950
8972
  // Core API ------------------------------------------------------------------
8951
- const version = "3.2.20";
8973
+ const version = "3.2.24";
8952
8974
  /**
8953
8975
  * SSR utils for \@vue/server-renderer. Only exposed in cjs builds.
8954
8976
  * @internal
@@ -9070,16 +9092,8 @@ function patchClass(el, value, isSVG) {
9070
9092
 
9071
9093
  function patchStyle(el, prev, next) {
9072
9094
  const style = el.style;
9073
- const currentDisplay = style.display;
9074
- if (!next) {
9075
- el.removeAttribute('style');
9076
- }
9077
- else if (isString(next)) {
9078
- if (prev !== next) {
9079
- style.cssText = next;
9080
- }
9081
- }
9082
- else {
9095
+ const isCssString = isString(next);
9096
+ if (next && !isCssString) {
9083
9097
  for (const key in next) {
9084
9098
  setStyle(style, key, next[key]);
9085
9099
  }
@@ -9091,11 +9105,22 @@ function patchStyle(el, prev, next) {
9091
9105
  }
9092
9106
  }
9093
9107
  }
9094
- // indicates that the `display` of the element is controlled by `v-show`,
9095
- // so we always keep the current `display` value regardless of the `style` value,
9096
- // thus handing over control to `v-show`.
9097
- if ('_vod' in el) {
9098
- style.display = currentDisplay;
9108
+ else {
9109
+ const currentDisplay = style.display;
9110
+ if (isCssString) {
9111
+ if (prev !== next) {
9112
+ style.cssText = next;
9113
+ }
9114
+ }
9115
+ else if (prev) {
9116
+ el.removeAttribute('style');
9117
+ }
9118
+ // indicates that the `display` of the element is controlled by `v-show`,
9119
+ // so we always keep the current `display` value regardless of the `style`
9120
+ // value, thus handing over control to `v-show`.
9121
+ if ('_vod' in el) {
9122
+ style.display = currentDisplay;
9123
+ }
9099
9124
  }
9100
9125
  }
9101
9126
  const importantRE = /\s*!important$/;
@@ -9178,12 +9203,19 @@ prevChildren, parentComponent, parentSuspense, unmountChildren) {
9178
9203
  el[key] = value == null ? '' : value;
9179
9204
  return;
9180
9205
  }
9181
- if (key === 'value' && el.tagName !== 'PROGRESS') {
9206
+ if (key === 'value' &&
9207
+ el.tagName !== 'PROGRESS' &&
9208
+ // custom elements may use _value internally
9209
+ !el.tagName.includes('-')) {
9182
9210
  // store value as _value as well since
9183
9211
  // non-string values will be stringified.
9184
9212
  el._value = value;
9185
9213
  const newValue = value == null ? '' : value;
9186
- if (el.value !== newValue) {
9214
+ if (el.value !== newValue ||
9215
+ // #4956: always set for OPTION elements because its value falls back to
9216
+ // textContent if no value attribute is present. And setting .value for
9217
+ // OPTION has no side effect
9218
+ el.tagName === 'OPTION') {
9187
9219
  el.value = newValue;
9188
9220
  }
9189
9221
  if (value == null) {
@@ -9441,22 +9473,11 @@ class VueElement extends BaseClass {
9441
9473
  }
9442
9474
  this.attachShadow({ mode: 'open' });
9443
9475
  }
9444
- // set initial attrs
9445
- for (let i = 0; i < this.attributes.length; i++) {
9446
- this._setAttr(this.attributes[i].name);
9447
- }
9448
- // watch future attr changes
9449
- new MutationObserver(mutations => {
9450
- for (const m of mutations) {
9451
- this._setAttr(m.attributeName);
9452
- }
9453
- }).observe(this, { attributes: true });
9454
9476
  }
9455
9477
  connectedCallback() {
9456
9478
  this._connected = true;
9457
9479
  if (!this._instance) {
9458
9480
  this._resolveDef();
9459
- this._update();
9460
9481
  }
9461
9482
  }
9462
9483
  disconnectedCallback() {
@@ -9475,8 +9496,18 @@ class VueElement extends BaseClass {
9475
9496
  if (this._resolved) {
9476
9497
  return;
9477
9498
  }
9499
+ this._resolved = true;
9500
+ // set initial attrs
9501
+ for (let i = 0; i < this.attributes.length; i++) {
9502
+ this._setAttr(this.attributes[i].name);
9503
+ }
9504
+ // watch future attr changes
9505
+ new MutationObserver(mutations => {
9506
+ for (const m of mutations) {
9507
+ this._setAttr(m.attributeName);
9508
+ }
9509
+ }).observe(this, { attributes: true });
9478
9510
  const resolve = (def) => {
9479
- this._resolved = true;
9480
9511
  const { props, styles } = def;
9481
9512
  const hasOptions = !isArray(props);
9482
9513
  const rawKeys = props ? (hasOptions ? Object.keys(props) : props) : [];
@@ -9491,14 +9522,11 @@ class VueElement extends BaseClass {
9491
9522
  }
9492
9523
  }
9493
9524
  }
9494
- if (numberProps) {
9495
- this._numberProps = numberProps;
9496
- this._update();
9497
- }
9525
+ this._numberProps = numberProps;
9498
9526
  // check if there are props set pre-upgrade or connect
9499
9527
  for (const key of Object.keys(this)) {
9500
9528
  if (key[0] !== '_') {
9501
- this._setProp(key, this[key]);
9529
+ this._setProp(key, this[key], true, false);
9502
9530
  }
9503
9531
  }
9504
9532
  // defining getter/setters on prototype
@@ -9512,7 +9540,10 @@ class VueElement extends BaseClass {
9512
9540
  }
9513
9541
  });
9514
9542
  }
9543
+ // apply CSS
9515
9544
  this._applyStyles(styles);
9545
+ // initial render
9546
+ this._update();
9516
9547
  };
9517
9548
  const asyncDef = this._def.__asyncLoader;
9518
9549
  if (asyncDef) {
@@ -9538,10 +9569,10 @@ class VueElement extends BaseClass {
9538
9569
  /**
9539
9570
  * @internal
9540
9571
  */
9541
- _setProp(key, val, shouldReflect = true) {
9572
+ _setProp(key, val, shouldReflect = true, shouldUpdate = true) {
9542
9573
  if (val !== this._props[key]) {
9543
9574
  this._props[key] = val;
9544
- if (this._instance) {
9575
+ if (shouldUpdate && this._instance) {
9545
9576
  this._update();
9546
9577
  }
9547
9578
  // reflect
@@ -9570,7 +9601,7 @@ class VueElement extends BaseClass {
9570
9601
  // HMR
9571
9602
  {
9572
9603
  instance.ceReload = newStyles => {
9573
- // alawys reset styles
9604
+ // always reset styles
9574
9605
  if (this._styles) {
9575
9606
  this._styles.forEach(s => this.shadowRoot.removeChild(s));
9576
9607
  this._styles.length = 0;