vue 2.6.4 → 2.6.8

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.
package/dist/vue.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * Vue.js v2.6.4
2
+ * Vue.js v2.6.8
3
3
  * (c) 2014-2019 Evan You
4
4
  * Released under the MIT License.
5
5
  */
@@ -481,7 +481,7 @@
481
481
  * using https://www.w3.org/TR/html53/semantics-scripting.html#potentialcustomelementname
482
482
  * skipping \u10000-\uEFFFF due to it freezing up PhantomJS
483
483
  */
484
- var unicodeLetters = 'a-zA-Z\u00B7\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u037D\u037F-\u1FFF\u200C-\u200D\u203F-\u2040\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD';
484
+ var unicodeRegExp = /a-zA-Z\u00B7\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u037D\u037F-\u1FFF\u200C-\u200D\u203F-\u2040\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD/;
485
485
 
486
486
  /**
487
487
  * Check if a string starts with $ or _
@@ -506,7 +506,7 @@
506
506
  /**
507
507
  * Parse simple path.
508
508
  */
509
- var bailRE = new RegExp(("[^" + unicodeLetters + ".$_\\d]"));
509
+ var bailRE = new RegExp(("[^" + (unicodeRegExp.source) + ".$_\\d]"));
510
510
  function parsePath (path) {
511
511
  if (bailRE.test(path)) {
512
512
  return
@@ -1410,7 +1410,7 @@
1410
1410
  }
1411
1411
 
1412
1412
  function validateComponentName (name) {
1413
- if (!new RegExp(("^[a-zA-Z][\\-\\.0-9_" + unicodeLetters + "]*$")).test(name)) {
1413
+ if (!new RegExp(("^[a-zA-Z][\\-\\.0-9_" + (unicodeRegExp.source) + "]*$")).test(name)) {
1414
1414
  warn(
1415
1415
  'Invalid component name: "' + name + '". Component names ' +
1416
1416
  'should conform to valid custom element name in html5 specification.'
@@ -1825,23 +1825,30 @@
1825
1825
  /* */
1826
1826
 
1827
1827
  function handleError (err, vm, info) {
1828
- if (vm) {
1829
- var cur = vm;
1830
- while ((cur = cur.$parent)) {
1831
- var hooks = cur.$options.errorCaptured;
1832
- if (hooks) {
1833
- for (var i = 0; i < hooks.length; i++) {
1834
- try {
1835
- var capture = hooks[i].call(cur, err, vm, info) === false;
1836
- if (capture) { return }
1837
- } catch (e) {
1838
- globalHandleError(e, cur, 'errorCaptured hook');
1828
+ // Deactivate deps tracking while processing error handler to avoid possible infinite rendering.
1829
+ // See: https://github.com/vuejs/vuex/issues/1505
1830
+ pushTarget();
1831
+ try {
1832
+ if (vm) {
1833
+ var cur = vm;
1834
+ while ((cur = cur.$parent)) {
1835
+ var hooks = cur.$options.errorCaptured;
1836
+ if (hooks) {
1837
+ for (var i = 0; i < hooks.length; i++) {
1838
+ try {
1839
+ var capture = hooks[i].call(cur, err, vm, info) === false;
1840
+ if (capture) { return }
1841
+ } catch (e) {
1842
+ globalHandleError(e, cur, 'errorCaptured hook');
1843
+ }
1839
1844
  }
1840
1845
  }
1841
1846
  }
1842
1847
  }
1848
+ globalHandleError(err, vm, info);
1849
+ } finally {
1850
+ popTarget();
1843
1851
  }
1844
- globalHandleError(err, vm, info);
1845
1852
  }
1846
1853
 
1847
1854
  function invokeWithErrorHandling (
@@ -1855,7 +1862,9 @@
1855
1862
  try {
1856
1863
  res = args ? handler.apply(context, args) : handler.call(context);
1857
1864
  if (res && !res._isVue && isPromise(res)) {
1858
- res.catch(function (e) { return handleError(e, vm, info + " (Promise/async)"); });
1865
+ // issue #9511
1866
+ // reassign to res to avoid catch triggering multiple times when nested calls
1867
+ res = res.catch(function (e) { return handleError(e, vm, info + " (Promise/async)"); });
1859
1868
  }
1860
1869
  } catch (e) {
1861
1870
  handleError(e, vm, info);
@@ -2538,26 +2547,35 @@
2538
2547
  prevSlots
2539
2548
  ) {
2540
2549
  var res;
2550
+ var isStable = slots ? !!slots.$stable : true;
2551
+ var key = slots && slots.$key;
2541
2552
  if (!slots) {
2542
2553
  res = {};
2543
2554
  } else if (slots._normalized) {
2544
2555
  // fast path 1: child component re-render only, parent did not change
2545
2556
  return slots._normalized
2546
- } else if (slots.$stable && prevSlots && prevSlots !== emptyObject) {
2547
- // fast path 2: stable scoped slots, only need to normalize once
2557
+ } else if (
2558
+ isStable &&
2559
+ prevSlots &&
2560
+ prevSlots !== emptyObject &&
2561
+ key === prevSlots.$key &&
2562
+ Object.keys(normalSlots).length === 0
2563
+ ) {
2564
+ // fast path 2: stable scoped slots w/ no normal slots to proxy,
2565
+ // only need to normalize once
2548
2566
  return prevSlots
2549
2567
  } else {
2550
2568
  res = {};
2551
- for (var key in slots) {
2552
- if (slots[key] && key[0] !== '$') {
2553
- res[key] = normalizeScopedSlot(normalSlots, key, slots[key]);
2569
+ for (var key$1 in slots) {
2570
+ if (slots[key$1] && key$1[0] !== '$') {
2571
+ res[key$1] = normalizeScopedSlot(normalSlots, key$1, slots[key$1]);
2554
2572
  }
2555
2573
  }
2556
2574
  }
2557
2575
  // expose normal slots on scopedSlots
2558
- for (var key$1 in normalSlots) {
2559
- if (!(key$1 in res)) {
2560
- res[key$1] = proxyNormalSlot(normalSlots, key$1);
2576
+ for (var key$2 in normalSlots) {
2577
+ if (!(key$2 in res)) {
2578
+ res[key$2] = proxyNormalSlot(normalSlots, key$2);
2561
2579
  }
2562
2580
  }
2563
2581
  // avoriaz seems to mock a non-extensible $scopedSlots object
@@ -2565,13 +2583,14 @@
2565
2583
  if (slots && Object.isExtensible(slots)) {
2566
2584
  (slots)._normalized = res;
2567
2585
  }
2568
- def(res, '$stable', slots ? !!slots.$stable : true);
2586
+ def(res, '$stable', isStable);
2587
+ def(res, '$key', key);
2569
2588
  return res
2570
2589
  }
2571
2590
 
2572
2591
  function normalizeScopedSlot(normalSlots, key, fn) {
2573
- var normalized = function (scope) {
2574
- var res = fn(scope || {});
2592
+ var normalized = function () {
2593
+ var res = arguments.length ? fn.apply(null, arguments) : fn({});
2575
2594
  res = res && typeof res === 'object' && !Array.isArray(res)
2576
2595
  ? [res] // single vnode
2577
2596
  : normalizeChildren(res);
@@ -2860,14 +2879,16 @@
2860
2879
 
2861
2880
  function resolveScopedSlots (
2862
2881
  fns, // see flow/vnode
2882
+ res,
2883
+ // the following are added in 2.6
2863
2884
  hasDynamicKeys,
2864
- res
2885
+ contentHashKey
2865
2886
  ) {
2866
2887
  res = res || { $stable: !hasDynamicKeys };
2867
2888
  for (var i = 0; i < fns.length; i++) {
2868
2889
  var slot = fns[i];
2869
2890
  if (Array.isArray(slot)) {
2870
- resolveScopedSlots(slot, hasDynamicKeys, res);
2891
+ resolveScopedSlots(slot, res, hasDynamicKeys);
2871
2892
  } else if (slot) {
2872
2893
  // marker for reverse proxying v-slot without scope on this.$slots
2873
2894
  if (slot.proxy) {
@@ -2876,6 +2897,9 @@
2876
2897
  res[slot.key] = slot.fn;
2877
2898
  }
2878
2899
  }
2900
+ if (contentHashKey) {
2901
+ (res).$key = contentHashKey;
2902
+ }
2879
2903
  return res
2880
2904
  }
2881
2905
 
@@ -3590,17 +3614,21 @@
3590
3614
  return factory.resolved
3591
3615
  }
3592
3616
 
3617
+ var owner = currentRenderingInstance;
3618
+ if (isDef(factory.owners) && factory.owners.indexOf(owner) === -1) {
3619
+ // already pending
3620
+ factory.owners.push(owner);
3621
+ }
3622
+
3593
3623
  if (isTrue(factory.loading) && isDef(factory.loadingComp)) {
3594
3624
  return factory.loadingComp
3595
3625
  }
3596
3626
 
3597
- var owner = currentRenderingInstance;
3598
- if (isDef(factory.owners)) {
3599
- // already pending
3600
- factory.owners.push(owner);
3601
- } else {
3627
+ if (!isDef(factory.owners)) {
3602
3628
  var owners = factory.owners = [owner];
3603
- var sync = true;
3629
+ var sync = true
3630
+
3631
+ ;(owner).$on('hook:destroyed', function () { return remove(owners, owner); });
3604
3632
 
3605
3633
  var forceRender = function (renderCompleted) {
3606
3634
  for (var i = 0, l = owners.length; i < l; i++) {
@@ -4053,9 +4081,12 @@
4053
4081
  // check if there are dynamic scopedSlots (hand-written or compiled but with
4054
4082
  // dynamic slot names). Static scoped slots compiled from template has the
4055
4083
  // "$stable" marker.
4084
+ var newScopedSlots = parentVnode.data.scopedSlots;
4085
+ var oldScopedSlots = vm.$scopedSlots;
4056
4086
  var hasDynamicScopedSlot = !!(
4057
- (parentVnode.data.scopedSlots && !parentVnode.data.scopedSlots.$stable) ||
4058
- (vm.$scopedSlots !== emptyObject && !vm.$scopedSlots.$stable)
4087
+ (newScopedSlots && !newScopedSlots.$stable) ||
4088
+ (oldScopedSlots !== emptyObject && !oldScopedSlots.$stable) ||
4089
+ (newScopedSlots && vm.$scopedSlots.$key !== newScopedSlots.$key)
4059
4090
  );
4060
4091
 
4061
4092
  // Any static slot children from the parent may have changed during parent's
@@ -5377,7 +5408,7 @@
5377
5408
  value: FunctionalRenderContext
5378
5409
  });
5379
5410
 
5380
- Vue.version = '2.6.4';
5411
+ Vue.version = '2.6.8';
5381
5412
 
5382
5413
  /* */
5383
5414
 
@@ -7463,9 +7494,17 @@
7463
7494
  var original = handler;
7464
7495
  handler = original._wrapper = function (e) {
7465
7496
  if (
7497
+ // no bubbling, should always fire.
7498
+ // this is just a safety net in case event.timeStamp is unreliable in
7499
+ // certain weird environments...
7500
+ e.target === e.currentTarget ||
7501
+ // event is fired after handler attachment
7466
7502
  e.timeStamp >= attachedTimestamp ||
7503
+ // #9462 bail for iOS 9 bug: event.timeStamp is 0 after history.pushState
7504
+ e.timeStamp === 0 ||
7467
7505
  // #9448 bail if event is fired in another document in a multi-page
7468
- // electron/nw.js app
7506
+ // electron/nw.js app, since event.timeStamp will be using a different
7507
+ // starting reference
7469
7508
  e.target.ownerDocument !== document
7470
7509
  ) {
7471
7510
  return original.apply(this, arguments)
@@ -7548,15 +7587,7 @@
7548
7587
  }
7549
7588
  }
7550
7589
 
7551
- // skip the update if old and new VDOM state is the same.
7552
- // the only exception is `value` where the DOM value may be temporarily
7553
- // out of sync with VDOM state due to focus, composition and modifiers.
7554
- // This also covers #4521 by skipping the unnecesarry `checked` update.
7555
- if (key !== 'value' && cur === oldProps[key]) {
7556
- continue
7557
- }
7558
-
7559
- if (key === 'value') {
7590
+ if (key === 'value' && elm.tagName !== 'PROGRESS') {
7560
7591
  // store value as _value as well since
7561
7592
  // non-string values will be stringified
7562
7593
  elm._value = cur;
@@ -7576,8 +7607,18 @@
7576
7607
  while (svg.firstChild) {
7577
7608
  elm.appendChild(svg.firstChild);
7578
7609
  }
7579
- } else {
7580
- elm[key] = cur;
7610
+ } else if (
7611
+ // skip the update if old and new VDOM state is the same.
7612
+ // `value` is handled separately because the DOM value may be temporarily
7613
+ // out of sync with VDOM state due to focus, composition and modifiers.
7614
+ // This #4521 by skipping the unnecesarry `checked` update.
7615
+ cur !== oldProps[key]
7616
+ ) {
7617
+ // some property updates can throw
7618
+ // e.g. `value` on <progress> w/ non-finite value
7619
+ try {
7620
+ elm[key] = cur;
7621
+ } catch (e) {}
7581
7622
  }
7582
7623
  }
7583
7624
  }
@@ -9169,7 +9210,7 @@
9169
9210
  // Regular Expressions for parsing tags and attributes
9170
9211
  var attribute = /^\s*([^\s"'<>\/=]+)(?:\s*(=)\s*(?:"([^"]*)"+|'([^']*)'+|([^\s"'=<>`]+)))?/;
9171
9212
  var dynamicArgAttribute = /^\s*((?:v-[\w-]+:|@|:|#)\[[^=]+\][^\s"'<>\/=]*)(?:\s*(=)\s*(?:"([^"]*)"+|'([^']*)'+|([^\s"'=<>`]+)))?/;
9172
- var ncname = "[a-zA-Z_][\\-\\.0-9_a-zA-Z" + unicodeLetters + "]*";
9213
+ var ncname = "[a-zA-Z_][\\-\\.0-9_a-zA-Z" + (unicodeRegExp.source) + "]*";
9173
9214
  var qnameCapture = "((?:" + ncname + "\\:)?" + ncname + ")";
9174
9215
  var startTagOpen = new RegExp(("^<" + qnameCapture));
9175
9216
  var startTagClose = /^\s*(\/?)>/;
@@ -9431,7 +9472,7 @@
9431
9472
  ) {
9432
9473
  options.warn(
9433
9474
  ("tag <" + (stack[i].tag) + "> has no matching end tag."),
9434
- { start: stack[i].start }
9475
+ { start: stack[i].start, end: stack[i].end }
9435
9476
  );
9436
9477
  }
9437
9478
  if (options.end) {
@@ -9468,7 +9509,7 @@
9468
9509
 
9469
9510
  var argRE = /:(.*)$/;
9470
9511
  var bindRE = /^:|^\.|^v-bind:/;
9471
- var modifierRE = /\.[^.]+/g;
9512
+ var modifierRE = /\.[^.\]]+(?=[^\]]*$)/g;
9472
9513
 
9473
9514
  var slotRE = /^v-slot(:|$)|^#/;
9474
9515
 
@@ -9645,7 +9686,7 @@
9645
9686
  shouldDecodeNewlinesForHref: options.shouldDecodeNewlinesForHref,
9646
9687
  shouldKeepComment: options.comments,
9647
9688
  outputSourceRange: options.outputSourceRange,
9648
- start: function start (tag, attrs, unary, start$1) {
9689
+ start: function start (tag, attrs, unary, start$1, end) {
9649
9690
  // check namespace.
9650
9691
  // inherit parent ns if there is one
9651
9692
  var ns = (currentParent && currentParent.ns) || platformGetTagNamespace(tag);
@@ -9664,6 +9705,7 @@
9664
9705
  {
9665
9706
  if (options.outputSourceRange) {
9666
9707
  element.start = start$1;
9708
+ element.end = end;
9667
9709
  element.rawAttrsMap = element.attrsList.reduce(function (cumulated, attr) {
9668
9710
  cumulated[attr.name] = attr;
9669
9711
  return cumulated
@@ -10781,7 +10823,13 @@
10781
10823
  }
10782
10824
 
10783
10825
  function genKeyFilter (keys) {
10784
- return ("if(('keyCode' in $event)&&" + (keys.map(genFilterCode).join('&&')) + ")return null;")
10826
+ return (
10827
+ // make sure the key filters only apply to KeyboardEvents
10828
+ // #9441: can't use 'keyCode' in $event because Chrome autofill fires fake
10829
+ // key events that do not have keyCode property...
10830
+ "if(!$event.type.indexOf('key')&&" +
10831
+ (keys.map(genFilterCode).join('&&')) + ")return null;"
10832
+ )
10785
10833
  }
10786
10834
 
10787
10835
  function genFilterCode (key) {
@@ -11142,26 +11190,68 @@
11142
11190
  // components with only scoped slots to skip forced updates from parent.
11143
11191
  // but in some cases we have to bail-out of this optimization
11144
11192
  // for example if the slot contains dynamic names, has v-if or v-for on them...
11145
- var needsForceUpdate = Object.keys(slots).some(function (key) {
11193
+ var needsForceUpdate = el.for || Object.keys(slots).some(function (key) {
11146
11194
  var slot = slots[key];
11147
- return slot.slotTargetDynamic || slot.if || slot.for
11195
+ return (
11196
+ slot.slotTargetDynamic ||
11197
+ slot.if ||
11198
+ slot.for ||
11199
+ containsSlotChild(slot) // is passing down slot from parent which may be dynamic
11200
+ )
11148
11201
  });
11149
- // OR when it is inside another scoped slot (the reactivity is disconnected)
11150
- // #9438
11202
+
11203
+ // #9534: if a component with scoped slots is inside a conditional branch,
11204
+ // it's possible for the same component to be reused but with different
11205
+ // compiled slot content. To avoid that, we generate a unique key based on
11206
+ // the generated code of all the slot contents.
11207
+ var needsKey = !!el.if;
11208
+
11209
+ // OR when it is inside another scoped slot or v-for (the reactivity may be
11210
+ // disconnected due to the intermediate scope variable)
11211
+ // #9438, #9506
11212
+ // TODO: this can be further optimized by properly analyzing in-scope bindings
11213
+ // and skip force updating ones that do not actually use scope variables.
11151
11214
  if (!needsForceUpdate) {
11152
11215
  var parent = el.parent;
11153
11216
  while (parent) {
11154
- if (parent.slotScope && parent.slotScope !== emptySlotScopeToken) {
11217
+ if (
11218
+ (parent.slotScope && parent.slotScope !== emptySlotScopeToken) ||
11219
+ parent.for
11220
+ ) {
11155
11221
  needsForceUpdate = true;
11156
11222
  break
11157
11223
  }
11224
+ if (parent.if) {
11225
+ needsKey = true;
11226
+ }
11158
11227
  parent = parent.parent;
11159
11228
  }
11160
11229
  }
11161
11230
 
11162
- return ("scopedSlots:_u([" + (Object.keys(slots).map(function (key) {
11163
- return genScopedSlot(slots[key], state)
11164
- }).join(',')) + "]" + (needsForceUpdate ? ",true" : "") + ")")
11231
+ var generatedSlots = Object.keys(slots)
11232
+ .map(function (key) { return genScopedSlot(slots[key], state); })
11233
+ .join(',');
11234
+
11235
+ return ("scopedSlots:_u([" + generatedSlots + "]" + (needsForceUpdate ? ",null,true" : "") + (!needsForceUpdate && needsKey ? (",null,false," + (hash(generatedSlots))) : "") + ")")
11236
+ }
11237
+
11238
+ function hash(str) {
11239
+ var hash = 5381;
11240
+ var i = str.length;
11241
+ while(i) {
11242
+ hash = (hash * 33) ^ str.charCodeAt(--i);
11243
+ }
11244
+ return hash >>> 0
11245
+ }
11246
+
11247
+ function containsSlotChild (el) {
11248
+ if (el.type === 1) {
11249
+ if (el.tag === 'slot') {
11250
+ return true
11251
+ }
11252
+ return el.children.some(containsSlotChild)
11253
+ }
11254
+ return false
11165
11255
  }
11166
11256
 
11167
11257
  function genScopedSlot (
@@ -11486,11 +11576,13 @@
11486
11576
 
11487
11577
  function repeat$1 (str, n) {
11488
11578
  var result = '';
11489
- while (true) { // eslint-disable-line
11490
- if (n & 1) { result += str; }
11491
- n >>>= 1;
11492
- if (n <= 0) { break }
11493
- str += str;
11579
+ if (n > 0) {
11580
+ while (true) { // eslint-disable-line
11581
+ if (n & 1) { result += str; }
11582
+ n >>>= 1;
11583
+ if (n <= 0) { break }
11584
+ str += str;
11585
+ }
11494
11586
  }
11495
11587
  return result
11496
11588
  }