vuejs-rails 1.0.24 → 1.0.26

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.
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * Vue.js v1.0.24
2
+ * Vue.js v1.0.26
3
3
  * (c) 2016 Evan You
4
4
  * Released under the MIT License.
5
5
  */
@@ -402,10 +402,15 @@
402
402
 
403
403
  // UA sniffing for working around browser-specific quirks
404
404
  var UA = inBrowser && window.navigator.userAgent.toLowerCase();
405
+ var isIE = UA && UA.indexOf('trident') > 0;
405
406
  var isIE9 = UA && UA.indexOf('msie 9.0') > 0;
406
407
  var isAndroid = UA && UA.indexOf('android') > 0;
407
408
  var isIos = UA && /(iphone|ipad|ipod|ios)/i.test(UA);
408
- var isWechat = UA && UA.indexOf('micromessenger') > 0;
409
+ var iosVersionMatch = isIos && UA.match(/os ([\d_]+)/);
410
+ var iosVersion = iosVersionMatch && iosVersionMatch[1].split('_');
411
+
412
+ // detecting iOS UIWebView by indexedDB
413
+ var hasMutationObserverBug = iosVersion && Number(iosVersion[0]) >= 9 && Number(iosVersion[1]) >= 3 && !window.indexedDB;
409
414
 
410
415
  var transitionProp = undefined;
411
416
  var transitionEndEvent = undefined;
@@ -446,7 +451,7 @@
446
451
  }
447
452
 
448
453
  /* istanbul ignore if */
449
- if (typeof MutationObserver !== 'undefined' && !(isWechat && isIos)) {
454
+ if (typeof MutationObserver !== 'undefined' && !hasMutationObserverBug) {
450
455
  var counter = 1;
451
456
  var observer = new MutationObserver(nextTickHandler);
452
457
  var textNode = document.createTextNode(counter);
@@ -518,12 +523,12 @@
518
523
 
519
524
  p.put = function (key, value) {
520
525
  var removed;
521
- if (this.size === this.limit) {
522
- removed = this.shift();
523
- }
524
526
 
525
527
  var entry = this.get(key, true);
526
528
  if (!entry) {
529
+ if (this.size === this.limit) {
530
+ removed = this.shift();
531
+ }
527
532
  entry = {
528
533
  key: key
529
534
  };
@@ -768,7 +773,7 @@ var directive = Object.freeze({
768
773
  var unsafeOpen = escapeRegex(config.unsafeDelimiters[0]);
769
774
  var unsafeClose = escapeRegex(config.unsafeDelimiters[1]);
770
775
  tagRE = new RegExp(unsafeOpen + '((?:.|\\n)+?)' + unsafeClose + '|' + open + '((?:.|\\n)+?)' + close, 'g');
771
- htmlRE = new RegExp('^' + unsafeOpen + '.*' + unsafeClose + '$');
776
+ htmlRE = new RegExp('^' + unsafeOpen + '((?:.|\\n)+?)' + unsafeClose + '$');
772
777
  // reset cache
773
778
  cache = new Cache(1000);
774
779
  }
@@ -1555,7 +1560,8 @@ var transition = Object.freeze({
1555
1560
  return (/HTMLUnknownElement/.test(el.toString()) &&
1556
1561
  // Chrome returns unknown for several HTML5 elements.
1557
1562
  // https://code.google.com/p/chromium/issues/detail?id=540526
1558
- !/^(data|time|rtc|rb)$/.test(tag)
1563
+ // Firefox returns unknown for some "Interactive elements."
1564
+ !/^(data|time|rtc|rb|details|dialog|summary)$/.test(tag)
1559
1565
  );
1560
1566
  }
1561
1567
  };
@@ -1891,7 +1897,9 @@ var transition = Object.freeze({
1891
1897
  }
1892
1898
  if (child.mixins) {
1893
1899
  for (var i = 0, l = child.mixins.length; i < l; i++) {
1894
- parent = mergeOptions(parent, child.mixins[i], vm);
1900
+ var mixin = child.mixins[i];
1901
+ var mixinOptions = mixin.prototype instanceof Vue ? mixin.options : mixin;
1902
+ parent = mergeOptions(parent, mixinOptions, vm);
1895
1903
  }
1896
1904
  }
1897
1905
  for (key in parent) {
@@ -2292,73 +2300,76 @@ var transition = Object.freeze({
2292
2300
 
2293
2301
 
2294
2302
  var util = Object.freeze({
2295
- defineReactive: defineReactive,
2296
- set: set,
2297
- del: del,
2298
- hasOwn: hasOwn,
2299
- isLiteral: isLiteral,
2300
- isReserved: isReserved,
2301
- _toString: _toString,
2302
- toNumber: toNumber,
2303
- toBoolean: toBoolean,
2304
- stripQuotes: stripQuotes,
2305
- camelize: camelize,
2306
- hyphenate: hyphenate,
2307
- classify: classify,
2308
- bind: bind,
2309
- toArray: toArray,
2310
- extend: extend,
2311
- isObject: isObject,
2312
- isPlainObject: isPlainObject,
2313
- def: def,
2314
- debounce: _debounce,
2315
- indexOf: indexOf,
2316
- cancellable: cancellable,
2317
- looseEqual: looseEqual,
2318
- isArray: isArray,
2319
- hasProto: hasProto,
2320
- inBrowser: inBrowser,
2321
- devtools: devtools,
2322
- isIE9: isIE9,
2323
- isAndroid: isAndroid,
2324
- isIos: isIos,
2325
- isWechat: isWechat,
2326
- get transitionProp () { return transitionProp; },
2327
- get transitionEndEvent () { return transitionEndEvent; },
2328
- get animationProp () { return animationProp; },
2329
- get animationEndEvent () { return animationEndEvent; },
2330
- nextTick: nextTick,
2331
- get _Set () { return _Set; },
2332
- query: query,
2333
- inDoc: inDoc,
2334
- getAttr: getAttr,
2335
- getBindAttr: getBindAttr,
2336
- hasBindAttr: hasBindAttr,
2337
- before: before,
2338
- after: after,
2339
- remove: remove,
2340
- prepend: prepend,
2341
- replace: replace,
2342
- on: on,
2343
- off: off,
2344
- setClass: setClass,
2345
- addClass: addClass,
2346
- removeClass: removeClass,
2347
- extractContent: extractContent,
2348
- trimNode: trimNode,
2349
- isTemplate: isTemplate,
2350
- createAnchor: createAnchor,
2351
- findRef: findRef,
2352
- mapNodeRange: mapNodeRange,
2353
- removeNodeRange: removeNodeRange,
2354
- isFragment: isFragment,
2355
- getOuterHTML: getOuterHTML,
2356
- mergeOptions: mergeOptions,
2357
- resolveAsset: resolveAsset,
2358
- checkComponentAttr: checkComponentAttr,
2359
- commonTagRE: commonTagRE,
2360
- reservedTagRE: reservedTagRE,
2361
- get warn () { return warn; }
2303
+ defineReactive: defineReactive,
2304
+ set: set,
2305
+ del: del,
2306
+ hasOwn: hasOwn,
2307
+ isLiteral: isLiteral,
2308
+ isReserved: isReserved,
2309
+ _toString: _toString,
2310
+ toNumber: toNumber,
2311
+ toBoolean: toBoolean,
2312
+ stripQuotes: stripQuotes,
2313
+ camelize: camelize,
2314
+ hyphenate: hyphenate,
2315
+ classify: classify,
2316
+ bind: bind,
2317
+ toArray: toArray,
2318
+ extend: extend,
2319
+ isObject: isObject,
2320
+ isPlainObject: isPlainObject,
2321
+ def: def,
2322
+ debounce: _debounce,
2323
+ indexOf: indexOf,
2324
+ cancellable: cancellable,
2325
+ looseEqual: looseEqual,
2326
+ isArray: isArray,
2327
+ hasProto: hasProto,
2328
+ inBrowser: inBrowser,
2329
+ devtools: devtools,
2330
+ isIE: isIE,
2331
+ isIE9: isIE9,
2332
+ isAndroid: isAndroid,
2333
+ isIos: isIos,
2334
+ iosVersionMatch: iosVersionMatch,
2335
+ iosVersion: iosVersion,
2336
+ hasMutationObserverBug: hasMutationObserverBug,
2337
+ get transitionProp () { return transitionProp; },
2338
+ get transitionEndEvent () { return transitionEndEvent; },
2339
+ get animationProp () { return animationProp; },
2340
+ get animationEndEvent () { return animationEndEvent; },
2341
+ nextTick: nextTick,
2342
+ get _Set () { return _Set; },
2343
+ query: query,
2344
+ inDoc: inDoc,
2345
+ getAttr: getAttr,
2346
+ getBindAttr: getBindAttr,
2347
+ hasBindAttr: hasBindAttr,
2348
+ before: before,
2349
+ after: after,
2350
+ remove: remove,
2351
+ prepend: prepend,
2352
+ replace: replace,
2353
+ on: on,
2354
+ off: off,
2355
+ setClass: setClass,
2356
+ addClass: addClass,
2357
+ removeClass: removeClass,
2358
+ extractContent: extractContent,
2359
+ trimNode: trimNode,
2360
+ isTemplate: isTemplate,
2361
+ createAnchor: createAnchor,
2362
+ findRef: findRef,
2363
+ mapNodeRange: mapNodeRange,
2364
+ removeNodeRange: removeNodeRange,
2365
+ isFragment: isFragment,
2366
+ getOuterHTML: getOuterHTML,
2367
+ mergeOptions: mergeOptions,
2368
+ resolveAsset: resolveAsset,
2369
+ checkComponentAttr: checkComponentAttr,
2370
+ commonTagRE: commonTagRE,
2371
+ reservedTagRE: reservedTagRE,
2372
+ get warn () { return warn; }
2362
2373
  });
2363
2374
 
2364
2375
  var uid = 0;
@@ -2810,7 +2821,9 @@ var path = Object.freeze({
2810
2821
  var restoreRE = /"(\d+)"/g;
2811
2822
  var pathTestRE = /^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*|\['.*?'\]|\[".*?"\]|\[\d+\]|\[[A-Za-z_$][\w$]*\])*$/;
2812
2823
  var identRE = /[^\w$\.](?:[A-Za-z_$][\w$]*)/g;
2813
- var booleanLiteralRE = /^(?:true|false)$/;
2824
+ var literalValueRE$1 = /^(?:true|false|null|undefined|Infinity|NaN)$/;
2825
+
2826
+ function noop() {}
2814
2827
 
2815
2828
  /**
2816
2829
  * Save / Rewrite / Restore
@@ -2892,7 +2905,7 @@ var path = Object.freeze({
2892
2905
  // save strings and object literal keys
2893
2906
  var body = exp.replace(saveRE, save).replace(wsRE, '');
2894
2907
  // rewrite all paths
2895
- // pad 1 space here becaue the regex matches 1 extra char
2908
+ // pad 1 space here because the regex matches 1 extra char
2896
2909
  body = (' ' + body).replace(identRE, rewrite).replace(restoreRE, restore);
2897
2910
  return makeGetterFn(body);
2898
2911
  }
@@ -2913,7 +2926,15 @@ var path = Object.freeze({
2913
2926
  return new Function('scope', 'return ' + body + ';');
2914
2927
  /* eslint-enable no-new-func */
2915
2928
  } catch (e) {
2916
- 'development' !== 'production' && warn('Invalid expression. ' + 'Generated function body: ' + body);
2929
+ if ('development' !== 'production') {
2930
+ /* istanbul ignore if */
2931
+ if (e.toString().match(/unsafe-eval|CSP/)) {
2932
+ warn('It seems you are using the default build of Vue.js in an environment ' + 'with Content Security Policy that prohibits unsafe-eval. ' + 'Use the CSP-compliant build instead: ' + 'http://vuejs.org/guide/installation.html#CSP-compliant-build');
2933
+ } else {
2934
+ warn('Invalid expression. ' + 'Generated function body: ' + body);
2935
+ }
2936
+ }
2937
+ return noop;
2917
2938
  }
2918
2939
  }
2919
2940
 
@@ -2975,8 +2996,8 @@ var path = Object.freeze({
2975
2996
 
2976
2997
  function isSimplePath(exp) {
2977
2998
  return pathTestRE.test(exp) &&
2978
- // don't treat true/false as paths
2979
- !booleanLiteralRE.test(exp) &&
2999
+ // don't treat literal values as paths
3000
+ !literalValueRE$1.test(exp) &&
2980
3001
  // Math constants e.g. Math.PI, Math.E etc.
2981
3002
  exp.slice(0, 5) !== 'Math.';
2982
3003
  }
@@ -3392,7 +3413,7 @@ var expression = Object.freeze({
3392
3413
  }
3393
3414
  var isA = isArray(val);
3394
3415
  var isO = isObject(val);
3395
- if (isA || isO) {
3416
+ if ((isA || isO) && Object.isExtensible(val)) {
3396
3417
  if (val.__ob__) {
3397
3418
  var depId = val.__ob__.dep.id;
3398
3419
  if (seen.has(depId)) {
@@ -3455,6 +3476,7 @@ var expression = Object.freeze({
3455
3476
 
3456
3477
  var tagRE$1 = /<([\w:-]+)/;
3457
3478
  var entityRE = /&#?\w+?;/;
3479
+ var commentRE = /<!--/;
3458
3480
 
3459
3481
  /**
3460
3482
  * Convert a string template to a DocumentFragment.
@@ -3477,8 +3499,9 @@ var expression = Object.freeze({
3477
3499
  var frag = document.createDocumentFragment();
3478
3500
  var tagMatch = templateString.match(tagRE$1);
3479
3501
  var entityMatch = entityRE.test(templateString);
3502
+ var commentMatch = commentRE.test(templateString);
3480
3503
 
3481
- if (!tagMatch && !entityMatch) {
3504
+ if (!tagMatch && !entityMatch && !commentMatch) {
3482
3505
  // text only, return a single text node.
3483
3506
  frag.appendChild(document.createTextNode(templateString));
3484
3507
  } else {
@@ -4445,7 +4468,7 @@ var template = Object.freeze({
4445
4468
  * the filters. This is passed to and called by the watcher.
4446
4469
  *
4447
4470
  * It is necessary for this to be called during the
4448
- * wathcer's dependency collection phase because we want
4471
+ * watcher's dependency collection phase because we want
4449
4472
  * the v-for to update when the source Object is mutated.
4450
4473
  */
4451
4474
 
@@ -4788,7 +4811,10 @@ var template = Object.freeze({
4788
4811
  },
4789
4812
 
4790
4813
  update: function update(value) {
4791
- this.el.value = _toString(value);
4814
+ // #3029 only update when the value changes. This prevent
4815
+ // browsers from overwriting values like selectionStart
4816
+ value = _toString(value);
4817
+ if (value !== this.el.value) this.el.value = value;
4792
4818
  },
4793
4819
 
4794
4820
  unbind: function unbind() {
@@ -4837,6 +4863,8 @@ var template = Object.freeze({
4837
4863
  var select = {
4838
4864
 
4839
4865
  bind: function bind() {
4866
+ var _this = this;
4867
+
4840
4868
  var self = this;
4841
4869
  var el = this.el;
4842
4870
 
@@ -4868,7 +4896,12 @@ var template = Object.freeze({
4868
4896
  // selectedIndex with value -1 to 0 when the element
4869
4897
  // is appended to a new parent, therefore we have to
4870
4898
  // force a DOM update whenever that happens...
4871
- this.vm.$on('hook:attached', this.forceUpdate);
4899
+ this.vm.$on('hook:attached', function () {
4900
+ nextTick(_this.forceUpdate);
4901
+ });
4902
+ if (!inDoc(el)) {
4903
+ nextTick(this.forceUpdate);
4904
+ }
4872
4905
  },
4873
4906
 
4874
4907
  update: function update(value) {
@@ -6138,7 +6171,7 @@ var template = Object.freeze({
6138
6171
  if (value === undefined) {
6139
6172
  value = getPropDefaultValue(vm, prop);
6140
6173
  }
6141
- value = coerceProp(prop, value);
6174
+ value = coerceProp(prop, value, vm);
6142
6175
  var coerced = value !== rawValue;
6143
6176
  if (!assertProp(prop, value, vm)) {
6144
6177
  value = undefined;
@@ -6257,13 +6290,17 @@ var template = Object.freeze({
6257
6290
  * @return {*}
6258
6291
  */
6259
6292
 
6260
- function coerceProp(prop, value) {
6293
+ function coerceProp(prop, value, vm) {
6261
6294
  var coerce = prop.options.coerce;
6262
6295
  if (!coerce) {
6263
6296
  return value;
6264
6297
  }
6265
- // coerce is a function
6266
- return coerce(value);
6298
+ if (typeof coerce === 'function') {
6299
+ return coerce(value);
6300
+ } else {
6301
+ 'development' !== 'production' && warn('Invalid coerce for prop "' + prop.name + '": expected function, got ' + typeof coerce + '.', vm);
6302
+ return value;
6303
+ }
6267
6304
  }
6268
6305
 
6269
6306
  /**
@@ -6795,10 +6832,9 @@ var template = Object.freeze({
6795
6832
  // resolve on owner vm
6796
6833
  var hooks = resolveAsset(this.vm.$options, 'transitions', id);
6797
6834
  id = id || 'v';
6835
+ oldId = oldId || 'v';
6798
6836
  el.__v_trans = new Transition(el, id, hooks, this.vm);
6799
- if (oldId) {
6800
- removeClass(el, oldId + '-transition');
6801
- }
6837
+ removeClass(el, oldId + '-transition');
6802
6838
  addClass(el, id + '-transition');
6803
6839
  }
6804
6840
  };
@@ -7216,7 +7252,7 @@ var template = Object.freeze({
7216
7252
  if (token.html) {
7217
7253
  replace(node, parseTemplate(value, true));
7218
7254
  } else {
7219
- node.data = value;
7255
+ node.data = _toString(value);
7220
7256
  }
7221
7257
  } else {
7222
7258
  vm._bindDir(token.descriptor, node, host, scope);
@@ -7784,11 +7820,11 @@ var template = Object.freeze({
7784
7820
 
7785
7821
 
7786
7822
  var compiler = Object.freeze({
7787
- compile: compile,
7788
- compileAndLinkProps: compileAndLinkProps,
7789
- compileRoot: compileRoot,
7790
- transclude: transclude,
7791
- resolveSlots: resolveSlots
7823
+ compile: compile,
7824
+ compileAndLinkProps: compileAndLinkProps,
7825
+ compileRoot: compileRoot,
7826
+ transclude: transclude,
7827
+ resolveSlots: resolveSlots
7792
7828
  });
7793
7829
 
7794
7830
  function stateMixin (Vue) {
@@ -8200,7 +8236,7 @@ var template = Object.freeze({
8200
8236
  };
8201
8237
  }
8202
8238
 
8203
- function noop() {}
8239
+ function noop$1() {}
8204
8240
 
8205
8241
  /**
8206
8242
  * A directive links a DOM element with a piece of data,
@@ -8299,7 +8335,7 @@ var template = Object.freeze({
8299
8335
  }
8300
8336
  };
8301
8337
  } else {
8302
- this._update = noop;
8338
+ this._update = noop$1;
8303
8339
  }
8304
8340
  var preProcess = this._preProcess ? bind(this._preProcess, this) : null;
8305
8341
  var postProcess = this._postProcess ? bind(this._postProcess, this) : null;
@@ -9737,7 +9773,7 @@ var template = Object.freeze({
9737
9773
 
9738
9774
  json: {
9739
9775
  read: function read(value, indent) {
9740
- return typeof value === 'string' ? value : JSON.stringify(value, null, Number(indent) || 2);
9776
+ return typeof value === 'string' ? value : JSON.stringify(value, null, arguments.length > 1 ? indent : 2);
9741
9777
  },
9742
9778
  write: function write(value) {
9743
9779
  try {
@@ -9810,7 +9846,13 @@ var template = Object.freeze({
9810
9846
 
9811
9847
  pluralize: function pluralize(value) {
9812
9848
  var args = toArray(arguments, 1);
9813
- return args.length > 1 ? args[value % 10 - 1] || args[args.length - 1] : args[0] + (value === 1 ? '' : 's');
9849
+ var length = args.length;
9850
+ if (length > 1) {
9851
+ var index = value % 10 - 1;
9852
+ return index in args ? args[index] : args[length - 1];
9853
+ } else {
9854
+ return args[0] + (value === 1 ? '' : 's');
9855
+ }
9814
9856
  },
9815
9857
 
9816
9858
  /**
@@ -9995,7 +10037,9 @@ var template = Object.freeze({
9995
10037
  }
9996
10038
  }
9997
10039
  if (type === 'component' && isPlainObject(definition)) {
9998
- definition.name = id;
10040
+ if (!definition.name) {
10041
+ definition.name = id;
10042
+ }
9999
10043
  definition = Vue.extend(definition);
10000
10044
  }
10001
10045
  this.options[type + 's'][id] = definition;
@@ -10010,7 +10054,7 @@ var template = Object.freeze({
10010
10054
 
10011
10055
  installGlobalAPI(Vue);
10012
10056
 
10013
- Vue.version = '1.0.24';
10057
+ Vue.version = '1.0.26';
10014
10058
 
10015
10059
  // devtools global hook
10016
10060
  /* istanbul ignore next */