vuejs-rails 2.0.5 → 2.0.8

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * Vue.js v2.0.5
2
+ * Vue.js v2.0.8
3
3
  * (c) 2014-2016 Evan You
4
4
  * Released under the MIT License.
5
5
  */
@@ -1112,9 +1112,11 @@ function defineReactive$$1 (
1112
1112
  },
1113
1113
  set: function reactiveSetter (newVal) {
1114
1114
  var value = getter ? getter.call(obj) : val;
1115
- if (newVal === value) {
1115
+ /* eslint-disable no-self-compare */
1116
+ if (newVal === value || (newVal !== newVal && value !== value)) {
1116
1117
  return
1117
1118
  }
1119
+ /* eslint-enable no-self-compare */
1118
1120
  if ("development" !== 'production' && customSetter) {
1119
1121
  customSetter();
1120
1122
  }
@@ -1188,7 +1190,7 @@ function del (obj, key) {
1188
1190
  * we cannot intercept array element access like property getters.
1189
1191
  */
1190
1192
  function dependArray (value) {
1191
- for (var e = void 0, i = 0, l = value.length; i < l; i++) {
1193
+ for (var e = (void 0), i = 0, l = value.length; i < l; i++) {
1192
1194
  e = value[i];
1193
1195
  e && e.__ob__ && e.__ob__.dep.depend();
1194
1196
  if (Array.isArray(e)) {
@@ -1208,6 +1210,8 @@ function initState (vm) {
1208
1210
  initWatch(vm);
1209
1211
  }
1210
1212
 
1213
+ var isReservedProp = makeMap('key,ref,slot');
1214
+
1211
1215
  function initProps (vm) {
1212
1216
  var props = vm.$options.props;
1213
1217
  if (props) {
@@ -1220,6 +1224,12 @@ function initProps (vm) {
1220
1224
  var key = keys[i];
1221
1225
  /* istanbul ignore else */
1222
1226
  {
1227
+ if (isReservedProp(key)) {
1228
+ warn(
1229
+ ("\"" + key + "\" is a reserved attribute and cannot be used as component prop."),
1230
+ vm
1231
+ );
1232
+ }
1223
1233
  defineReactive$$1(vm, key, validateProp(key, props, propsData, vm), function () {
1224
1234
  if (vm.$parent && !observerState.isSettingProps) {
1225
1235
  warn(
@@ -1321,16 +1331,12 @@ function initMethods (vm) {
1321
1331
  if (methods) {
1322
1332
  for (var key in methods) {
1323
1333
  vm[key] = methods[key] == null ? noop : bind$1(methods[key], vm);
1324
- {
1325
- methods[key] == null && warn(
1334
+ if ("development" !== 'production' && methods[key] == null) {
1335
+ warn(
1326
1336
  "method \"" + key + "\" has an undefined value in the component definition. " +
1327
1337
  "Did you reference the function correctly?",
1328
1338
  vm
1329
1339
  );
1330
- hasOwn(Vue$2.prototype, key) && warn(
1331
- ("Avoid overriding Vue's internal method \"" + key + "\"."),
1332
- vm
1333
- );
1334
1340
  }
1335
1341
  }
1336
1342
  }
@@ -1602,7 +1608,9 @@ function normalizeChildren (
1602
1608
  }
1603
1609
  } else if (c instanceof VNode) {
1604
1610
  if (c.text && last && last.text) {
1605
- last.text += c.text;
1611
+ if (!last.isCloned) {
1612
+ last.text += c.text;
1613
+ }
1606
1614
  } else {
1607
1615
  // inherit parent namespace
1608
1616
  if (ns) {
@@ -1681,7 +1689,7 @@ function lifecycleMixin (Vue) {
1681
1689
  vm.$options.render = emptyVNode;
1682
1690
  {
1683
1691
  /* istanbul ignore if */
1684
- if (vm.$options.template) {
1692
+ if (vm.$options.template && vm.$options.template.charAt(0) !== '#') {
1685
1693
  warn(
1686
1694
  'You are using the runtime-only build of Vue where the template ' +
1687
1695
  'option is not available. Either pre-compile the templates into ' +
@@ -1856,8 +1864,9 @@ function createComponent (
1856
1864
  return
1857
1865
  }
1858
1866
 
1867
+ var baseCtor = context.$options._base;
1859
1868
  if (isObject(Ctor)) {
1860
- Ctor = Vue$2.extend(Ctor);
1869
+ Ctor = baseCtor.extend(Ctor);
1861
1870
  }
1862
1871
 
1863
1872
  if (typeof Ctor !== 'function') {
@@ -1867,16 +1876,12 @@ function createComponent (
1867
1876
  return
1868
1877
  }
1869
1878
 
1870
- // resolve constructor options in case global mixins are applied after
1871
- // component constructor creation
1872
- resolveConstructorOptions(Ctor);
1873
-
1874
1879
  // async component
1875
1880
  if (!Ctor.cid) {
1876
1881
  if (Ctor.resolved) {
1877
1882
  Ctor = Ctor.resolved;
1878
1883
  } else {
1879
- Ctor = resolveAsyncComponent(Ctor, function () {
1884
+ Ctor = resolveAsyncComponent(Ctor, baseCtor, function () {
1880
1885
  // it's ok to queue this on every render because
1881
1886
  // $forceUpdate is buffered by the scheduler.
1882
1887
  context.$forceUpdate();
@@ -1889,6 +1894,10 @@ function createComponent (
1889
1894
  }
1890
1895
  }
1891
1896
 
1897
+ // resolve constructor options in case global mixins are applied after
1898
+ // component constructor creation
1899
+ resolveConstructorOptions(Ctor);
1900
+
1892
1901
  data = data || {};
1893
1902
 
1894
1903
  // extract props
@@ -1987,6 +1996,10 @@ function init (vnode, hydrating) {
1987
1996
  if (!vnode.child || vnode.child._isDestroyed) {
1988
1997
  var child = vnode.child = createComponentInstanceForVnode(vnode, activeInstance);
1989
1998
  child.$mount(hydrating ? vnode.elm : undefined, hydrating);
1999
+ } else if (vnode.data.keepAlive) {
2000
+ // kept-alive components, treat as a patch
2001
+ var mountedNode = vnode; // work around flow
2002
+ prepatch(mountedNode, mountedNode);
1990
2003
  }
1991
2004
  }
1992
2005
 
@@ -2028,6 +2041,7 @@ function destroy$1 (vnode) {
2028
2041
 
2029
2042
  function resolveAsyncComponent (
2030
2043
  factory,
2044
+ baseCtor,
2031
2045
  cb
2032
2046
  ) {
2033
2047
  if (factory.requested) {
@@ -2040,7 +2054,7 @@ function resolveAsyncComponent (
2040
2054
 
2041
2055
  var resolve = function (res) {
2042
2056
  if (isObject(res)) {
2043
- res = Vue$2.extend(res);
2057
+ res = baseCtor.extend(res);
2044
2058
  }
2045
2059
  // cache resolved
2046
2060
  factory.resolved = res;
@@ -2397,6 +2411,7 @@ function renderMixin (Vue) {
2397
2411
  // apply v-bind object
2398
2412
  Vue.prototype._b = function bindProps (
2399
2413
  data,
2414
+ tag,
2400
2415
  value,
2401
2416
  asProp
2402
2417
  ) {
@@ -2414,7 +2429,7 @@ function renderMixin (Vue) {
2414
2429
  if (key === 'class' || key === 'style') {
2415
2430
  data[key] = value[key];
2416
2431
  } else {
2417
- var hash = asProp || config.mustUseProp(key)
2432
+ var hash = asProp || config.mustUseProp(tag, key)
2418
2433
  ? data.domProps || (data.domProps = {})
2419
2434
  : data.attrs || (data.attrs = {});
2420
2435
  hash[key] = value[key];
@@ -2618,19 +2633,19 @@ function resolveConstructorOptions (Ctor) {
2618
2633
  return options
2619
2634
  }
2620
2635
 
2621
- function Vue$2 (options) {
2636
+ function Vue$3 (options) {
2622
2637
  if ("development" !== 'production' &&
2623
- !(this instanceof Vue$2)) {
2638
+ !(this instanceof Vue$3)) {
2624
2639
  warn('Vue is a constructor and should be called with the `new` keyword');
2625
2640
  }
2626
2641
  this._init(options);
2627
2642
  }
2628
2643
 
2629
- initMixin(Vue$2);
2630
- stateMixin(Vue$2);
2631
- eventsMixin(Vue$2);
2632
- lifecycleMixin(Vue$2);
2633
- renderMixin(Vue$2);
2644
+ initMixin(Vue$3);
2645
+ stateMixin(Vue$3);
2646
+ eventsMixin(Vue$3);
2647
+ lifecycleMixin(Vue$3);
2648
+ renderMixin(Vue$3);
2634
2649
 
2635
2650
  var warn = noop;
2636
2651
  var formatComponentName;
@@ -2695,13 +2710,16 @@ var strats = config.optionMergeStrategies;
2695
2710
  * Helper that recursively merges two data objects together.
2696
2711
  */
2697
2712
  function mergeData (to, from) {
2713
+ if (!from) { return to }
2698
2714
  var key, toVal, fromVal;
2699
- for (key in from) {
2715
+ var keys = Object.keys(from);
2716
+ for (var i = 0; i < keys.length; i++) {
2717
+ key = keys[i];
2700
2718
  toVal = to[key];
2701
2719
  fromVal = from[key];
2702
2720
  if (!hasOwn(to, key)) {
2703
2721
  set(to, key, fromVal);
2704
- } else if (isObject(toVal) && isObject(fromVal)) {
2722
+ } else if (isPlainObject(toVal) && isPlainObject(fromVal)) {
2705
2723
  mergeData(toVal, fromVal);
2706
2724
  }
2707
2725
  }
@@ -2933,7 +2951,7 @@ function mergeOptions (
2933
2951
  if (child.mixins) {
2934
2952
  for (var i = 0, l = child.mixins.length; i < l; i++) {
2935
2953
  var mixin = child.mixins[i];
2936
- if (mixin.prototype instanceof Vue$2) {
2954
+ if (mixin.prototype instanceof Vue$3) {
2937
2955
  mixin = mixin.options;
2938
2956
  }
2939
2957
  parent = mergeOptions(parent, mixin, vm);
@@ -3227,7 +3245,7 @@ function initUse (Vue) {
3227
3245
 
3228
3246
  function initMixin$1 (Vue) {
3229
3247
  Vue.mixin = function (mixin) {
3230
- Vue.options = mergeOptions(Vue.options, mixin);
3248
+ this.options = mergeOptions(this.options, mixin);
3231
3249
  };
3232
3250
  }
3233
3251
 
@@ -3248,9 +3266,10 @@ function initExtend (Vue) {
3248
3266
  Vue.extend = function (extendOptions) {
3249
3267
  extendOptions = extendOptions || {};
3250
3268
  var Super = this;
3251
- var isFirstExtend = Super.cid === 0;
3252
- if (isFirstExtend && extendOptions._Ctor) {
3253
- return extendOptions._Ctor
3269
+ var SuperId = Super.cid;
3270
+ var cachedCtors = extendOptions._Ctor || (extendOptions._Ctor = {});
3271
+ if (cachedCtors[SuperId]) {
3272
+ return cachedCtors[SuperId]
3254
3273
  }
3255
3274
  var name = extendOptions.name || Super.options.name;
3256
3275
  {
@@ -3272,8 +3291,10 @@ function initExtend (Vue) {
3272
3291
  extendOptions
3273
3292
  );
3274
3293
  Sub['super'] = Super;
3275
- // allow further extension
3294
+ // allow further extension/mixin/plugin usage
3276
3295
  Sub.extend = Super.extend;
3296
+ Sub.mixin = Super.mixin;
3297
+ Sub.use = Super.use;
3277
3298
  // create asset registers, so extended classes
3278
3299
  // can have their private assets too.
3279
3300
  config._assetTypes.forEach(function (type) {
@@ -3289,9 +3310,7 @@ function initExtend (Vue) {
3289
3310
  Sub.superOptions = Super.options;
3290
3311
  Sub.extendOptions = extendOptions;
3291
3312
  // cache constructor
3292
- if (isFirstExtend) {
3293
- extendOptions._Ctor = Sub;
3294
- }
3313
+ cachedCtors[SuperId] = Sub;
3295
3314
  return Sub
3296
3315
  };
3297
3316
  }
@@ -3321,7 +3340,7 @@ function initAssetRegisters (Vue) {
3321
3340
  }
3322
3341
  if (type === 'component' && isPlainObject(definition)) {
3323
3342
  definition.name = definition.name || id;
3324
- definition = Vue.extend(definition);
3343
+ definition = this.options._base.extend(definition);
3325
3344
  }
3326
3345
  if (type === 'directive' && typeof definition === 'function') {
3327
3346
  definition = { bind: definition, update: definition };
@@ -3396,6 +3415,10 @@ function initGlobalAPI (Vue) {
3396
3415
  Vue.options[type + 's'] = Object.create(null);
3397
3416
  });
3398
3417
 
3418
+ // this is used to identify the "base" constructor to extend all plain-object
3419
+ // components with in Weex's multi-instance scenarios.
3420
+ Vue.options._base = Vue;
3421
+
3399
3422
  extend(Vue.options.components, builtInComponents);
3400
3423
 
3401
3424
  initUse(Vue);
@@ -3404,18 +3427,25 @@ function initGlobalAPI (Vue) {
3404
3427
  initAssetRegisters(Vue);
3405
3428
  }
3406
3429
 
3407
- initGlobalAPI(Vue$2);
3430
+ initGlobalAPI(Vue$3);
3408
3431
 
3409
- Object.defineProperty(Vue$2.prototype, '$isServer', {
3432
+ Object.defineProperty(Vue$3.prototype, '$isServer', {
3410
3433
  get: function () { return config._isServer; }
3411
3434
  });
3412
3435
 
3413
- Vue$2.version = '2.0.5';
3436
+ Vue$3.version = '2.0.8';
3414
3437
 
3415
3438
  /* */
3416
3439
 
3417
3440
  // attributes that should be using props for binding
3418
- var mustUseProp = makeMap('value,selected,checked,muted');
3441
+ var mustUseProp = function (tag, attr) {
3442
+ return (
3443
+ (attr === 'value' && (tag === 'input' || tag === 'textarea' || tag === 'option')) ||
3444
+ (attr === 'selected' && tag === 'option') ||
3445
+ (attr === 'checked' && tag === 'input') ||
3446
+ (attr === 'muted' && tag === 'video')
3447
+ )
3448
+ };
3419
3449
 
3420
3450
  var isEnumeratedAttr = makeMap('contenteditable,draggable,spellcheck');
3421
3451
 
@@ -3537,7 +3567,7 @@ function stringifyClass (value) {
3537
3567
  var namespaceMap = {
3538
3568
  svg: 'http://www.w3.org/2000/svg',
3539
3569
  math: 'http://www.w3.org/1998/Math/MathML',
3540
- xhtml: 'http://www.w3.org/1999/xhtm'
3570
+ xhtml: 'http://www.w3.org/1999/xhtml'
3541
3571
  };
3542
3572
 
3543
3573
  var isHTMLTag = makeMap(
@@ -3759,7 +3789,7 @@ function registerRef (vnode, isRemoval) {
3759
3789
  }
3760
3790
  } else {
3761
3791
  if (vnode.data.refInFor) {
3762
- if (Array.isArray(refs[key])) {
3792
+ if (Array.isArray(refs[key]) && refs[key].indexOf(ref) < 0) {
3763
3793
  refs[key].push(ref);
3764
3794
  } else {
3765
3795
  refs[key] = [ref];
@@ -4215,7 +4245,7 @@ function createPatchFunction (backend) {
4215
4245
  if (vnode.tag) {
4216
4246
  return (
4217
4247
  vnode.tag.indexOf('vue-component') === 0 ||
4218
- vnode.tag === nodeOps.tagName(node).toLowerCase()
4248
+ vnode.tag.toLowerCase() === nodeOps.tagName(node).toLowerCase()
4219
4249
  )
4220
4250
  } else {
4221
4251
  return _toString(vnode.text) === node.data
@@ -4549,13 +4579,14 @@ function updateDOMProps (oldVnode, vnode) {
4549
4579
  }
4550
4580
  }
4551
4581
  for (key in props) {
4582
+ cur = props[key];
4552
4583
  // ignore children if the node has textContent or innerHTML,
4553
4584
  // as these will throw away existing DOM nodes and cause removal errors
4554
4585
  // on subsequent patches (#3360)
4555
- if ((key === 'textContent' || key === 'innerHTML') && vnode.children) {
4556
- vnode.children.length = 0;
4586
+ if (key === 'textContent' || key === 'innerHTML') {
4587
+ if (vnode.children) { vnode.children.length = 0; }
4588
+ if (cur === oldProps[key]) { continue }
4557
4589
  }
4558
- cur = props[key];
4559
4590
  if (key === 'value') {
4560
4591
  // store value as _value as well since
4561
4592
  // non-string values will be stringified
@@ -4578,6 +4609,75 @@ var domProps = {
4578
4609
 
4579
4610
  /* */
4580
4611
 
4612
+ var parseStyleText = cached(function (cssText) {
4613
+ var res = {};
4614
+ var hasBackground = cssText.indexOf('background') >= 0;
4615
+ // maybe with background-image: url(http://xxx) or base64 img
4616
+ var listDelimiter = hasBackground ? /;(?![^(]*\))/g : ';';
4617
+ var propertyDelimiter = hasBackground ? /:(.+)/ : ':';
4618
+ cssText.split(listDelimiter).forEach(function (item) {
4619
+ if (item) {
4620
+ var tmp = item.split(propertyDelimiter);
4621
+ tmp.length > 1 && (res[tmp[0].trim()] = tmp[1].trim());
4622
+ }
4623
+ });
4624
+ return res
4625
+ });
4626
+
4627
+ // merge static and dynamic style data on the same vnode
4628
+ function normalizeStyleData (data) {
4629
+ var style = normalizeStyleBinding(data.style);
4630
+ // static style is pre-processed into an object during compilation
4631
+ // and is always a fresh object, so it's safe to merge into it
4632
+ return data.staticStyle
4633
+ ? extend(data.staticStyle, style)
4634
+ : style
4635
+ }
4636
+
4637
+ // normalize possible array / string values into Object
4638
+ function normalizeStyleBinding (bindingStyle) {
4639
+ if (Array.isArray(bindingStyle)) {
4640
+ return toObject(bindingStyle)
4641
+ }
4642
+ if (typeof bindingStyle === 'string') {
4643
+ return parseStyleText(bindingStyle)
4644
+ }
4645
+ return bindingStyle
4646
+ }
4647
+
4648
+ /**
4649
+ * parent component style should be after child's
4650
+ * so that parent component's style could override it
4651
+ */
4652
+ function getStyle (vnode, checkChild) {
4653
+ var res = {};
4654
+ var styleData;
4655
+
4656
+ if (checkChild) {
4657
+ var childNode = vnode;
4658
+ while (childNode.child) {
4659
+ childNode = childNode.child._vnode;
4660
+ if (childNode.data && (styleData = normalizeStyleData(childNode.data))) {
4661
+ extend(res, styleData);
4662
+ }
4663
+ }
4664
+ }
4665
+
4666
+ if ((styleData = normalizeStyleData(vnode.data))) {
4667
+ extend(res, styleData);
4668
+ }
4669
+
4670
+ var parentNode = vnode;
4671
+ while ((parentNode = parentNode.parent)) {
4672
+ if (parentNode.data && (styleData = normalizeStyleData(parentNode.data))) {
4673
+ extend(res, styleData);
4674
+ }
4675
+ }
4676
+ return res
4677
+ }
4678
+
4679
+ /* */
4680
+
4581
4681
  var cssVarRE = /^--/;
4582
4682
  var setProp = function (el, name, val) {
4583
4683
  /* istanbul ignore if */
@@ -4607,40 +4707,35 @@ var normalize = cached(function (prop) {
4607
4707
  });
4608
4708
 
4609
4709
  function updateStyle (oldVnode, vnode) {
4610
- if ((!oldVnode.data || !oldVnode.data.style) && !vnode.data.style) {
4710
+ var data = vnode.data;
4711
+ var oldData = oldVnode.data;
4712
+
4713
+ if (!data.staticStyle && !data.style &&
4714
+ !oldData.staticStyle && !oldData.style) {
4611
4715
  return
4612
4716
  }
4717
+
4613
4718
  var cur, name;
4614
4719
  var el = vnode.elm;
4615
- var oldStyle = oldVnode.data.style || {};
4616
- var style = vnode.data.style || {};
4720
+ var oldStaticStyle = oldVnode.data.staticStyle;
4721
+ var oldStyleBinding = oldVnode.data.style || {};
4617
4722
 
4618
- // handle string
4619
- if (typeof style === 'string') {
4620
- el.style.cssText = style;
4621
- return
4622
- }
4723
+ // if static style exists, stylebinding already merged into it when doing normalizeStyleData
4724
+ var oldStyle = oldStaticStyle || oldStyleBinding;
4623
4725
 
4624
- var needClone = style.__ob__;
4726
+ var style = normalizeStyleBinding(vnode.data.style) || {};
4625
4727
 
4626
- // handle array syntax
4627
- if (Array.isArray(style)) {
4628
- style = vnode.data.style = toObject(style);
4629
- }
4728
+ vnode.data.style = style.__ob__ ? extend({}, style) : style;
4630
4729
 
4631
- // clone the style for future updates,
4632
- // in case the user mutates the style object in-place.
4633
- if (needClone) {
4634
- style = vnode.data.style = extend({}, style);
4635
- }
4730
+ var newStyle = getStyle(vnode, true);
4636
4731
 
4637
4732
  for (name in oldStyle) {
4638
- if (style[name] == null) {
4733
+ if (newStyle[name] == null) {
4639
4734
  setProp(el, name, '');
4640
4735
  }
4641
4736
  }
4642
- for (name in style) {
4643
- cur = style[name];
4737
+ for (name in newStyle) {
4738
+ cur = newStyle[name];
4644
4739
  if (cur !== oldStyle[name]) {
4645
4740
  // ie9 setting to null has no effect, must use empty string
4646
4741
  setProp(el, name, cur == null ? '' : cur);
@@ -5546,7 +5641,7 @@ var TransitionGroup = {
5546
5641
 
5547
5642
  updated: function updated () {
5548
5643
  var children = this.prevChildren;
5549
- var moveClass = this.moveClass || (this.name + '-move');
5644
+ var moveClass = this.moveClass || ((this.name || 'v') + '-move');
5550
5645
  if (!children.length || !this.hasMove(children[0].elm, moveClass)) {
5551
5646
  return
5552
5647
  }
@@ -5630,20 +5725,20 @@ var platformComponents = {
5630
5725
  /* */
5631
5726
 
5632
5727
  // install platform specific utils
5633
- Vue$2.config.isUnknownElement = isUnknownElement;
5634
- Vue$2.config.isReservedTag = isReservedTag;
5635
- Vue$2.config.getTagNamespace = getTagNamespace;
5636
- Vue$2.config.mustUseProp = mustUseProp;
5728
+ Vue$3.config.isUnknownElement = isUnknownElement;
5729
+ Vue$3.config.isReservedTag = isReservedTag;
5730
+ Vue$3.config.getTagNamespace = getTagNamespace;
5731
+ Vue$3.config.mustUseProp = mustUseProp;
5637
5732
 
5638
5733
  // install platform runtime directives & components
5639
- extend(Vue$2.options.directives, platformDirectives);
5640
- extend(Vue$2.options.components, platformComponents);
5734
+ extend(Vue$3.options.directives, platformDirectives);
5735
+ extend(Vue$3.options.components, platformComponents);
5641
5736
 
5642
5737
  // install platform patch function
5643
- Vue$2.prototype.__patch__ = config._isServer ? noop : patch$1;
5738
+ Vue$3.prototype.__patch__ = config._isServer ? noop : patch$1;
5644
5739
 
5645
5740
  // wrap mount
5646
- Vue$2.prototype.$mount = function (
5741
+ Vue$3.prototype.$mount = function (
5647
5742
  el,
5648
5743
  hydrating
5649
5744
  ) {
@@ -5656,7 +5751,7 @@ Vue$2.prototype.$mount = function (
5656
5751
  setTimeout(function () {
5657
5752
  if (config.devtools) {
5658
5753
  if (devtools) {
5659
- devtools.emit('init', Vue$2);
5754
+ devtools.emit('init', Vue$3);
5660
5755
  } else if (
5661
5756
  "development" !== 'production' &&
5662
5757
  inBrowser && /Chrome\/\d+/.test(window.navigator.userAgent)
@@ -5684,9 +5779,10 @@ var shouldDecodeNewlines = inBrowser ? shouldDecode('\n', '&#10;') : false;
5684
5779
 
5685
5780
  /* */
5686
5781
 
5687
- var decoder = document.createElement('div');
5782
+ var decoder;
5688
5783
 
5689
5784
  function decode (html) {
5785
+ decoder = decoder || document.createElement('div');
5690
5786
  decoder.innerHTML = html;
5691
5787
  return decoder.textContent
5692
5788
  }
@@ -5829,7 +5925,7 @@ function parseHTML (html, options) {
5829
5925
  }
5830
5926
  }
5831
5927
 
5832
- var text = void 0, rest$1 = void 0, next = void 0;
5928
+ var text = (void 0), rest$1 = (void 0), next = (void 0);
5833
5929
  if (textEnd > 0) {
5834
5930
  rest$1 = html.slice(textEnd);
5835
5931
  while (
@@ -6219,6 +6315,95 @@ function getAndRemoveAttr (el, name) {
6219
6315
  return val
6220
6316
  }
6221
6317
 
6318
+ var len;
6319
+ var str;
6320
+ var chr;
6321
+ var index$1;
6322
+ var expressionPos;
6323
+ var expressionEndPos;
6324
+
6325
+ /**
6326
+ * parse directive model to do the array update transform. a[idx] = val => $$a.splice($$idx, 1, val)
6327
+ *
6328
+ * for loop possible cases:
6329
+ *
6330
+ * - test
6331
+ * - test[idx]
6332
+ * - test[test1[idx]]
6333
+ * - test["a"][idx]
6334
+ * - xxx.test[a[a].test1[idx]]
6335
+ * - test.xxx.a["asa"][test1[idx]]
6336
+ *
6337
+ */
6338
+
6339
+ function parseModel (val) {
6340
+ str = val;
6341
+ len = str.length;
6342
+ index$1 = expressionPos = expressionEndPos = 0;
6343
+
6344
+ if (val.indexOf('[') < 0 || val.lastIndexOf(']') < len - 1) {
6345
+ return {
6346
+ exp: val,
6347
+ idx: null
6348
+ }
6349
+ }
6350
+
6351
+ while (!eof()) {
6352
+ chr = next();
6353
+ /* istanbul ignore if */
6354
+ if (isStringStart(chr)) {
6355
+ parseString(chr);
6356
+ } else if (chr === 0x5B) {
6357
+ parseBracket(chr);
6358
+ }
6359
+ }
6360
+
6361
+ return {
6362
+ exp: val.substring(0, expressionPos),
6363
+ idx: val.substring(expressionPos + 1, expressionEndPos)
6364
+ }
6365
+ }
6366
+
6367
+ function next () {
6368
+ return str.charCodeAt(++index$1)
6369
+ }
6370
+
6371
+ function eof () {
6372
+ return index$1 >= len
6373
+ }
6374
+
6375
+ function isStringStart (chr) {
6376
+ return chr === 0x22 || chr === 0x27
6377
+ }
6378
+
6379
+ function parseBracket (chr) {
6380
+ var inBracket = 1;
6381
+ expressionPos = index$1;
6382
+ while (!eof()) {
6383
+ chr = next();
6384
+ if (isStringStart(chr)) {
6385
+ parseString(chr);
6386
+ continue
6387
+ }
6388
+ if (chr === 0x5B) { inBracket++; }
6389
+ if (chr === 0x5D) { inBracket--; }
6390
+ if (inBracket === 0) {
6391
+ expressionEndPos = index$1;
6392
+ break
6393
+ }
6394
+ }
6395
+ }
6396
+
6397
+ function parseString (chr) {
6398
+ var stringQuote = chr;
6399
+ while (!eof()) {
6400
+ chr = next();
6401
+ if (chr === stringQuote) {
6402
+ break
6403
+ }
6404
+ }
6405
+ }
6406
+
6222
6407
  /* */
6223
6408
 
6224
6409
  var dirRE = /^v-|^@|^:/;
@@ -6417,6 +6602,13 @@ function parse (
6417
6602
  }
6418
6603
  return
6419
6604
  }
6605
+ // IE textarea placeholder bug
6606
+ /* istanbul ignore if */
6607
+ if (options.isIE &&
6608
+ currentParent.tag === 'textarea' &&
6609
+ currentParent.attrsMap.placeholder === text) {
6610
+ return
6611
+ }
6420
6612
  text = inPre || text.trim()
6421
6613
  ? decodeHTMLCached(text)
6422
6614
  // only preserve whitespace if its not right after a starting tag
@@ -6578,7 +6770,7 @@ function processAttrs (el) {
6578
6770
  name = camelize(name);
6579
6771
  if (name === 'innerHtml') { name = 'innerHTML'; }
6580
6772
  }
6581
- if (isProp || platformMustUseProp(name)) {
6773
+ if (isProp || platformMustUseProp(el.tag, name)) {
6582
6774
  addProp(el, name, value);
6583
6775
  } else {
6584
6776
  addAttr(el, name, value);
@@ -6734,6 +6926,16 @@ function genStaticKeys$1 (keys) {
6734
6926
  function markStatic (node) {
6735
6927
  node.static = isStatic(node);
6736
6928
  if (node.type === 1) {
6929
+ // do not make component slot content static. this avoids
6930
+ // 1. components not able to mutate slot nodes
6931
+ // 2. static slot content fails for hot-reloading
6932
+ if (
6933
+ !isPlatformReservedTag(node.tag) &&
6934
+ node.tag !== 'slot' &&
6935
+ node.attrsMap['inline-template'] == null
6936
+ ) {
6937
+ return
6938
+ }
6737
6939
  for (var i = 0, l = node.children.length; i < l; i++) {
6738
6940
  var child = node.children[i];
6739
6941
  markStatic(child);
@@ -6749,13 +6951,26 @@ function markStaticRoots (node, isInFor) {
6749
6951
  if (node.static || node.once) {
6750
6952
  node.staticInFor = isInFor;
6751
6953
  }
6752
- if (node.static) {
6954
+ // For a node to qualify as a static root, it should have children that
6955
+ // are not just static text. Otherwise the cost of hoisting out will
6956
+ // outweigh the benefits and it's better off to just always render it fresh.
6957
+ if (node.static && node.children.length && !(
6958
+ node.children.length === 1 &&
6959
+ node.children[0].type === 3
6960
+ )) {
6753
6961
  node.staticRoot = true;
6754
6962
  return
6963
+ } else {
6964
+ node.staticRoot = false;
6755
6965
  }
6756
6966
  if (node.children) {
6757
6967
  for (var i = 0, l = node.children.length; i < l; i++) {
6758
- markStaticRoots(node.children[i], isInFor || !!node.for);
6968
+ var child = node.children[i];
6969
+ isInFor = isInFor || !!node.for;
6970
+ markStaticRoots(child, isInFor);
6971
+ if (child.type === 1 && child.elseBlock) {
6972
+ markStaticRoots(child.elseBlock, isInFor);
6973
+ }
6759
6974
  }
6760
6975
  }
6761
6976
  }
@@ -6876,7 +7091,7 @@ function normalizeKeyCode (key) {
6876
7091
 
6877
7092
  function bind$2 (el, dir) {
6878
7093
  el.wrapData = function (code) {
6879
- return ("_b(" + code + "," + (dir.value) + (dir.modifiers && dir.modifiers.prop ? ',true' : '') + ")")
7094
+ return ("_b(" + code + ",'" + (el.tag) + "'," + (dir.value) + (dir.modifiers && dir.modifiers.prop ? ',true' : '') + ")")
6880
7095
  };
6881
7096
  }
6882
7097
 
@@ -6961,7 +7176,9 @@ function genStatic (el) {
6961
7176
  // v-once
6962
7177
  function genOnce (el) {
6963
7178
  el.onceProcessed = true;
6964
- if (el.staticInFor) {
7179
+ if (el.if && !el.ifProcessed) {
7180
+ return genIf(el)
7181
+ } else if (el.staticInFor) {
6965
7182
  var key = '';
6966
7183
  var parent = el.parent;
6967
7184
  while (parent) {
@@ -6983,10 +7200,11 @@ function genOnce (el) {
6983
7200
  }
6984
7201
  }
6985
7202
 
7203
+ // v-if with v-once shuold generate code like (a)?_m(0):_m(1)
6986
7204
  function genIf (el) {
6987
7205
  var exp = el.if;
6988
7206
  el.ifProcessed = true; // avoid recursion
6989
- return ("(" + exp + ")?" + (genElement(el)) + ":" + (genElse(el)))
7207
+ return ("(" + exp + ")?" + (el.once ? genOnce(el) : genElement(el)) + ":" + (genElse(el)))
6990
7208
  }
6991
7209
 
6992
7210
  function genElse (el) {
@@ -7278,7 +7496,25 @@ var klass$1 = {
7278
7496
 
7279
7497
  /* */
7280
7498
 
7281
- function transformNode$1 (el) {
7499
+ function transformNode$1 (el, options) {
7500
+ var warn = options.warn || baseWarn;
7501
+ var staticStyle = getAndRemoveAttr(el, 'style');
7502
+ if (staticStyle) {
7503
+ /* istanbul ignore if */
7504
+ {
7505
+ var expression = parseText(staticStyle, options.delimiters);
7506
+ if (expression) {
7507
+ warn(
7508
+ "style=\"" + staticStyle + "\": " +
7509
+ 'Interpolation inside attributes has been removed. ' +
7510
+ 'Use v-bind or the colon shorthand instead. For example, ' +
7511
+ 'instead of <div style="{{ val }}">, use <div :style="val">.'
7512
+ );
7513
+ }
7514
+ }
7515
+ el.staticStyle = JSON.stringify(parseStyleText(staticStyle));
7516
+ }
7517
+
7282
7518
  var styleBinding = getBindingAttr(el, 'style', false /* getStatic */);
7283
7519
  if (styleBinding) {
7284
7520
  el.styleBinding = styleBinding;
@@ -7286,12 +7522,18 @@ function transformNode$1 (el) {
7286
7522
  }
7287
7523
 
7288
7524
  function genData$2 (el) {
7289
- return el.styleBinding
7290
- ? ("style:(" + (el.styleBinding) + "),")
7291
- : ''
7525
+ var data = '';
7526
+ if (el.staticStyle) {
7527
+ data += "staticStyle:" + (el.staticStyle) + ",";
7528
+ }
7529
+ if (el.styleBinding) {
7530
+ data += "style:(" + (el.styleBinding) + "),";
7531
+ }
7532
+ return data
7292
7533
  }
7293
7534
 
7294
7535
  var style$1 = {
7536
+ staticKeys: ['staticStyle'],
7295
7537
  transformNode: transformNode$1,
7296
7538
  genData: genData$2
7297
7539
  };
@@ -7303,97 +7545,6 @@ var modules$1 = [
7303
7545
 
7304
7546
  /* */
7305
7547
 
7306
- var len;
7307
- var str;
7308
- var chr;
7309
- var index$1;
7310
- var expressionPos;
7311
- var expressionEndPos;
7312
-
7313
- /**
7314
- * parse directive model to do the array update transform. a[idx] = val => $$a.splice($$idx, 1, val)
7315
- *
7316
- * for loop possible cases:
7317
- *
7318
- * - test
7319
- * - test[idx]
7320
- * - test[test1[idx]]
7321
- * - test["a"][idx]
7322
- * - xxx.test[a[a].test1[idx]]
7323
- * - test.xxx.a["asa"][test1[idx]]
7324
- *
7325
- */
7326
-
7327
- function parseModel (val) {
7328
- str = val;
7329
- len = str.length;
7330
- index$1 = expressionPos = expressionEndPos = 0;
7331
-
7332
- if (val.indexOf('[') < 0) {
7333
- return {
7334
- exp: val,
7335
- idx: null
7336
- }
7337
- }
7338
-
7339
- while (!eof()) {
7340
- chr = next();
7341
- /* istanbul ignore if */
7342
- if (isStringStart(chr)) {
7343
- parseString(chr);
7344
- } else if (chr === 0x5B) {
7345
- parseBracket(chr);
7346
- }
7347
- }
7348
-
7349
- return {
7350
- exp: val.substring(0, expressionPos),
7351
- idx: val.substring(expressionPos + 1, expressionEndPos)
7352
- }
7353
- }
7354
-
7355
- function next () {
7356
- return str.charCodeAt(++index$1)
7357
- }
7358
-
7359
- function eof () {
7360
- return index$1 >= len
7361
- }
7362
-
7363
- function isStringStart (chr) {
7364
- return chr === 0x22 || chr === 0x27
7365
- }
7366
-
7367
- function parseBracket (chr) {
7368
- var inBracket = 1;
7369
- expressionPos = index$1;
7370
- while (!eof()) {
7371
- chr = next();
7372
- if (isStringStart(chr)) {
7373
- parseString(chr);
7374
- continue
7375
- }
7376
- if (chr === 0x5B) { inBracket++; }
7377
- if (chr === 0x5D) { inBracket--; }
7378
- if (inBracket === 0) {
7379
- expressionEndPos = index$1;
7380
- break
7381
- }
7382
- }
7383
- }
7384
-
7385
- function parseString (chr) {
7386
- var stringQuote = chr;
7387
- while (!eof()) {
7388
- chr = next();
7389
- if (chr === stringQuote) {
7390
- break
7391
- }
7392
- }
7393
- }
7394
-
7395
- /* */
7396
-
7397
7548
  var warn$3;
7398
7549
 
7399
7550
  function model$1 (
@@ -7517,7 +7668,7 @@ function genDefaultModel (
7517
7668
 
7518
7669
  var valueExpression = isNative
7519
7670
  ? ("$event.target.value" + (trim ? '.trim()' : ''))
7520
- : "$event";
7671
+ : trim ? "(typeof $event === 'string' ? $event.trim() : $event)" : "$event";
7521
7672
  valueExpression = number || type === 'number'
7522
7673
  ? ("_n(" + valueExpression + ")")
7523
7674
  : valueExpression;
@@ -7698,8 +7849,8 @@ var idToTemplate = cached(function (id) {
7698
7849
  return el && el.innerHTML
7699
7850
  });
7700
7851
 
7701
- var mount = Vue$2.prototype.$mount;
7702
- Vue$2.prototype.$mount = function (
7852
+ var mount = Vue$3.prototype.$mount;
7853
+ Vue$3.prototype.$mount = function (
7703
7854
  el,
7704
7855
  hydrating
7705
7856
  ) {
@@ -7721,6 +7872,13 @@ Vue$2.prototype.$mount = function (
7721
7872
  if (typeof template === 'string') {
7722
7873
  if (template.charAt(0) === '#') {
7723
7874
  template = idToTemplate(template);
7875
+ /* istanbul ignore if */
7876
+ if ("development" !== 'production' && !template) {
7877
+ warn(
7878
+ ("Template element not found or is empty: " + (options.template)),
7879
+ this
7880
+ );
7881
+ }
7724
7882
  }
7725
7883
  } else if (template.nodeType) {
7726
7884
  template = template.innerHTML;
@@ -7762,8 +7920,8 @@ function getOuterHTML (el) {
7762
7920
  }
7763
7921
  }
7764
7922
 
7765
- Vue$2.compile = compileToFunctions;
7923
+ Vue$3.compile = compileToFunctions;
7766
7924
 
7767
- return Vue$2;
7925
+ return Vue$3;
7768
7926
 
7769
7927
  })));