@vue/runtime-dom 3.2.30 → 3.2.33

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 templateContainer = doc && doc.createElement('template');
10
+ const templateContainer = doc && /*#__PURE__*/ doc.createElement('template');
11
11
  const nodeOps = {
12
12
  insert: (child, parent, anchor) => {
13
13
  parent.insertBefore(child, anchor || null);
@@ -158,6 +158,8 @@ function setStyle(style, name, val) {
158
158
  val.forEach(v => setStyle(style, name, v));
159
159
  }
160
160
  else {
161
+ if (val == null)
162
+ val = '';
161
163
  if (name.startsWith('--')) {
162
164
  // custom property definition
163
165
  style.setProperty(name, val);
@@ -252,31 +254,28 @@ prevChildren, parentComponent, parentSuspense, unmountChildren) {
252
254
  }
253
255
  return;
254
256
  }
257
+ let needRemove = false;
255
258
  if (value === '' || value == null) {
256
259
  const type = typeof el[key];
257
260
  if (type === 'boolean') {
258
261
  // e.g. <select multiple> compiles to { multiple: '' }
259
- el[key] = shared.includeBooleanAttr(value);
260
- return;
262
+ value = shared.includeBooleanAttr(value);
261
263
  }
262
264
  else if (value == null && type === 'string') {
263
265
  // e.g. <div :id="null">
264
- el[key] = '';
265
- el.removeAttribute(key);
266
- return;
266
+ value = '';
267
+ needRemove = true;
267
268
  }
268
269
  else if (type === 'number') {
269
270
  // e.g. <img :width="null">
270
271
  // the value of some IDL attr must be greater than 0, e.g. input.size = 0 -> error
271
- try {
272
- el[key] = 0;
273
- }
274
- catch (_a) { }
275
- el.removeAttribute(key);
276
- return;
272
+ value = 0;
273
+ needRemove = true;
277
274
  }
278
275
  }
279
- // some properties perform value validation and throw
276
+ // some properties perform value validation and throw,
277
+ // some properties has getter, no setter, will error in 'use strict'
278
+ // eg. <select :type="null"></select> <select :willValidate="null"></select>
280
279
  try {
281
280
  el[key] = value;
282
281
  }
@@ -286,31 +285,35 @@ prevChildren, parentComponent, parentSuspense, unmountChildren) {
286
285
  `value ${value} is invalid.`, e);
287
286
  }
288
287
  }
288
+ needRemove && el.removeAttribute(key);
289
289
  }
290
290
 
291
291
  // Async edge case fix requires storing an event listener's attach timestamp.
292
- let _getNow = Date.now;
293
- let skipTimestampCheck = false;
294
- if (typeof window !== 'undefined') {
295
- // Determine what event timestamp the browser is using. Annoyingly, the
296
- // timestamp can either be hi-res (relative to page load) or low-res
297
- // (relative to UNIX epoch), so in order to compare time we have to use the
298
- // same timestamp type when saving the flush timestamp.
299
- if (_getNow() > document.createEvent('Event').timeStamp) {
300
- // if the low-res timestamp which is bigger than the event timestamp
301
- // (which is evaluated AFTER) it means the event is using a hi-res timestamp,
302
- // and we need to use the hi-res version for event listeners as well.
303
- _getNow = () => performance.now();
304
- }
305
- // #3485: Firefox <= 53 has incorrect Event.timeStamp implementation
306
- // and does not fire microtasks in between event propagation, so safe to exclude.
307
- const ffMatch = navigator.userAgent.match(/firefox\/(\d+)/i);
308
- skipTimestampCheck = !!(ffMatch && Number(ffMatch[1]) <= 53);
309
- }
292
+ const [_getNow, skipTimestampCheck] = /*#__PURE__*/ (() => {
293
+ let _getNow = Date.now;
294
+ let skipTimestampCheck = false;
295
+ if (typeof window !== 'undefined') {
296
+ // Determine what event timestamp the browser is using. Annoyingly, the
297
+ // timestamp can either be hi-res (relative to page load) or low-res
298
+ // (relative to UNIX epoch), so in order to compare time we have to use the
299
+ // same timestamp type when saving the flush timestamp.
300
+ if (Date.now() > document.createEvent('Event').timeStamp) {
301
+ // if the low-res timestamp which is bigger than the event timestamp
302
+ // (which is evaluated AFTER) it means the event is using a hi-res timestamp,
303
+ // and we need to use the hi-res version for event listeners as well.
304
+ _getNow = () => performance.now();
305
+ }
306
+ // #3485: Firefox <= 53 has incorrect Event.timeStamp implementation
307
+ // and does not fire microtasks in between event propagation, so safe to exclude.
308
+ const ffMatch = navigator.userAgent.match(/firefox\/(\d+)/i);
309
+ skipTimestampCheck = !!(ffMatch && Number(ffMatch[1]) <= 53);
310
+ }
311
+ return [_getNow, skipTimestampCheck];
312
+ })();
310
313
  // To avoid the overhead of repeatedly calling performance.now(), we cache
311
314
  // and use the same timestamp for all event listeners attached in the same tick.
312
315
  let cachedNow = 0;
313
- const p = Promise.resolve();
316
+ const p = /*#__PURE__*/ Promise.resolve();
314
317
  const reset = () => {
315
318
  cachedNow = 0;
316
319
  };
@@ -435,13 +438,13 @@ function shouldSetAsProp(el, key, value, isSVG) {
435
438
  }
436
439
  return false;
437
440
  }
438
- // spellcheck and draggable are numerated attrs, however their
439
- // corresponding DOM properties are actually booleans - this leads to
440
- // setting it with a string "false" value leading it to be coerced to
441
- // `true`, so we need to always treat them as attributes.
441
+ // these are enumerated attrs, however their corresponding DOM properties
442
+ // are actually booleans - this leads to setting it with a string "false"
443
+ // value leading it to be coerced to `true`, so we need to always treat
444
+ // them as attributes.
442
445
  // Note that `contentEditable` doesn't have this problem: its DOM
443
446
  // property is also enumerated string values.
444
- if (key === 'spellcheck' || key === 'draggable') {
447
+ if (key === 'spellcheck' || key === 'draggable' || key === 'translate') {
445
448
  return false;
446
449
  }
447
450
  // #1787, #2840 form property on form elements is readonly and must be set as
@@ -1492,7 +1495,7 @@ function initVShowForSSR() {
1492
1495
  };
1493
1496
  }
1494
1497
 
1495
- const rendererOptions = shared.extend({ patchProp }, nodeOps);
1498
+ const rendererOptions = /*#__PURE__*/ shared.extend({ patchProp }, nodeOps);
1496
1499
  // lazy create the renderer - this makes core renderer logic tree-shakable
1497
1500
  // in case the user only imports reactivity utilities from Vue.
1498
1501
  let renderer;
@@ -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 templateContainer = doc && doc.createElement('template');
10
+ const templateContainer = doc && /*#__PURE__*/ doc.createElement('template');
11
11
  const nodeOps = {
12
12
  insert: (child, parent, anchor) => {
13
13
  parent.insertBefore(child, anchor || null);
@@ -158,6 +158,8 @@ function setStyle(style, name, val) {
158
158
  val.forEach(v => setStyle(style, name, v));
159
159
  }
160
160
  else {
161
+ if (val == null)
162
+ val = '';
161
163
  if (name.startsWith('--')) {
162
164
  // custom property definition
163
165
  style.setProperty(name, val);
@@ -252,61 +254,62 @@ prevChildren, parentComponent, parentSuspense, unmountChildren) {
252
254
  }
253
255
  return;
254
256
  }
257
+ let needRemove = false;
255
258
  if (value === '' || value == null) {
256
259
  const type = typeof el[key];
257
260
  if (type === 'boolean') {
258
261
  // e.g. <select multiple> compiles to { multiple: '' }
259
- el[key] = shared.includeBooleanAttr(value);
260
- return;
262
+ value = shared.includeBooleanAttr(value);
261
263
  }
262
264
  else if (value == null && type === 'string') {
263
265
  // e.g. <div :id="null">
264
- el[key] = '';
265
- el.removeAttribute(key);
266
- return;
266
+ value = '';
267
+ needRemove = true;
267
268
  }
268
269
  else if (type === 'number') {
269
270
  // e.g. <img :width="null">
270
271
  // the value of some IDL attr must be greater than 0, e.g. input.size = 0 -> error
271
- try {
272
- el[key] = 0;
273
- }
274
- catch (_a) { }
275
- el.removeAttribute(key);
276
- return;
272
+ value = 0;
273
+ needRemove = true;
277
274
  }
278
275
  }
279
- // some properties perform value validation and throw
276
+ // some properties perform value validation and throw,
277
+ // some properties has getter, no setter, will error in 'use strict'
278
+ // eg. <select :type="null"></select> <select :willValidate="null"></select>
280
279
  try {
281
280
  el[key] = value;
282
281
  }
283
282
  catch (e) {
284
283
  }
284
+ needRemove && el.removeAttribute(key);
285
285
  }
286
286
 
287
287
  // Async edge case fix requires storing an event listener's attach timestamp.
288
- let _getNow = Date.now;
289
- let skipTimestampCheck = false;
290
- if (typeof window !== 'undefined') {
291
- // Determine what event timestamp the browser is using. Annoyingly, the
292
- // timestamp can either be hi-res (relative to page load) or low-res
293
- // (relative to UNIX epoch), so in order to compare time we have to use the
294
- // same timestamp type when saving the flush timestamp.
295
- if (_getNow() > document.createEvent('Event').timeStamp) {
296
- // if the low-res timestamp which is bigger than the event timestamp
297
- // (which is evaluated AFTER) it means the event is using a hi-res timestamp,
298
- // and we need to use the hi-res version for event listeners as well.
299
- _getNow = () => performance.now();
300
- }
301
- // #3485: Firefox <= 53 has incorrect Event.timeStamp implementation
302
- // and does not fire microtasks in between event propagation, so safe to exclude.
303
- const ffMatch = navigator.userAgent.match(/firefox\/(\d+)/i);
304
- skipTimestampCheck = !!(ffMatch && Number(ffMatch[1]) <= 53);
305
- }
288
+ const [_getNow, skipTimestampCheck] = /*#__PURE__*/ (() => {
289
+ let _getNow = Date.now;
290
+ let skipTimestampCheck = false;
291
+ if (typeof window !== 'undefined') {
292
+ // Determine what event timestamp the browser is using. Annoyingly, the
293
+ // timestamp can either be hi-res (relative to page load) or low-res
294
+ // (relative to UNIX epoch), so in order to compare time we have to use the
295
+ // same timestamp type when saving the flush timestamp.
296
+ if (Date.now() > document.createEvent('Event').timeStamp) {
297
+ // if the low-res timestamp which is bigger than the event timestamp
298
+ // (which is evaluated AFTER) it means the event is using a hi-res timestamp,
299
+ // and we need to use the hi-res version for event listeners as well.
300
+ _getNow = () => performance.now();
301
+ }
302
+ // #3485: Firefox <= 53 has incorrect Event.timeStamp implementation
303
+ // and does not fire microtasks in between event propagation, so safe to exclude.
304
+ const ffMatch = navigator.userAgent.match(/firefox\/(\d+)/i);
305
+ skipTimestampCheck = !!(ffMatch && Number(ffMatch[1]) <= 53);
306
+ }
307
+ return [_getNow, skipTimestampCheck];
308
+ })();
306
309
  // To avoid the overhead of repeatedly calling performance.now(), we cache
307
310
  // and use the same timestamp for all event listeners attached in the same tick.
308
311
  let cachedNow = 0;
309
- const p = Promise.resolve();
312
+ const p = /*#__PURE__*/ Promise.resolve();
310
313
  const reset = () => {
311
314
  cachedNow = 0;
312
315
  };
@@ -431,13 +434,13 @@ function shouldSetAsProp(el, key, value, isSVG) {
431
434
  }
432
435
  return false;
433
436
  }
434
- // spellcheck and draggable are numerated attrs, however their
435
- // corresponding DOM properties are actually booleans - this leads to
436
- // setting it with a string "false" value leading it to be coerced to
437
- // `true`, so we need to always treat them as attributes.
437
+ // these are enumerated attrs, however their corresponding DOM properties
438
+ // are actually booleans - this leads to setting it with a string "false"
439
+ // value leading it to be coerced to `true`, so we need to always treat
440
+ // them as attributes.
438
441
  // Note that `contentEditable` doesn't have this problem: its DOM
439
442
  // property is also enumerated string values.
440
- if (key === 'spellcheck' || key === 'draggable') {
443
+ if (key === 'spellcheck' || key === 'draggable' || key === 'translate') {
441
444
  return false;
442
445
  }
443
446
  // #1787, #2840 form property on form elements is readonly and must be set as
@@ -1443,7 +1446,7 @@ function initVShowForSSR() {
1443
1446
  };
1444
1447
  }
1445
1448
 
1446
- const rendererOptions = shared.extend({ patchProp }, nodeOps);
1449
+ const rendererOptions = /*#__PURE__*/ shared.extend({ patchProp }, nodeOps);
1447
1450
  // lazy create the renderer - this makes core renderer logic tree-shakable
1448
1451
  // in case the user only imports reactivity utilities from Vue.
1449
1452
  let renderer;