Skip to content

Commit c6c5919

Browse files
committed
1.0.28
1 parent 9507402 commit c6c5919

File tree

4 files changed

+86
-78
lines changed

4 files changed

+86
-78
lines changed

src/guide/installation.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22
title: Installation
33
type: guide
44
order: 0
5-
vue_version: 1.0.27
6-
dev_size: "251.35"
7-
min_size: "75.87"
8-
gz_size: "26.23"
5+
vue_version: 1.0.28
6+
dev_size: "252.14"
7+
min_size: "75.66"
8+
gz_size: "26.19"
99
---
1010

1111
### Compatibility Note

themes/vue/_config.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
google_analytics: UA-46852172-1
22
root_domain: vuejs.org
3-
vue_version: 1.0.27
3+
vue_version: 1.0.28

themes/vue/source/js/vue.js

Lines changed: 77 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*!
2-
* Vue.js v1.0.27
2+
* Vue.js v1.0.28
33
* (c) 2016 Evan You
44
* Released under the MIT License.
55
*/
@@ -405,6 +405,7 @@ var UA = inBrowser && window.navigator.userAgent.toLowerCase();
405405
var isIE = UA && UA.indexOf('trident') > 0;
406406
var isIE9 = UA && UA.indexOf('msie 9.0') > 0;
407407
var isAndroid = UA && UA.indexOf('android') > 0;
408+
var isIOS = UA && /iphone|ipad|ipod|ios/.test(UA);
408409

409410
var transitionProp = undefined;
410411
var transitionEndEvent = undefined;
@@ -421,6 +422,12 @@ if (inBrowser && !isIE9) {
421422
animationEndEvent = isWebkitAnim ? 'webkitAnimationEnd' : 'animationend';
422423
}
423424

425+
/* istanbul ignore next */
426+
function isNative(Ctor) {
427+
return (/native code/.test(Ctor.toString())
428+
);
429+
}
430+
424431
/**
425432
* Defer a task to execute it asynchronously. Ideally this
426433
* should be executed as a microtask, so we leverage
@@ -434,33 +441,53 @@ if (inBrowser && !isIE9) {
434441
var nextTick = (function () {
435442
var callbacks = [];
436443
var pending = false;
437-
var timerFunc;
444+
var timerFunc = undefined;
445+
438446
function nextTickHandler() {
439447
pending = false;
440448
var copies = callbacks.slice(0);
441-
callbacks = [];
449+
callbacks.length = 0;
442450
for (var i = 0; i < copies.length; i++) {
443451
copies[i]();
444452
}
445453
}
446454

447-
/* istanbul ignore else */
448-
if (inBrowser && window.postMessage && !window.importScripts && // not in WebWorker
449-
!(isAndroid && !window.requestAnimationFrame) // not in Android <= 4.3
450-
) {
451-
(function () {
452-
var NEXT_TICK_TOKEN = '__vue__nextTick__';
453-
window.addEventListener('message', function (e) {
454-
if (e.source === window && e.data === NEXT_TICK_TOKEN) {
455-
nextTickHandler();
456-
}
457-
});
458-
timerFunc = function () {
459-
window.postMessage(NEXT_TICK_TOKEN, '*');
460-
};
461-
})();
462-
} else {
463-
timerFunc = typeof global !== 'undefined' && global.setImmediate || setTimeout;
455+
// the nextTick behavior leverages the microtask queue, which can be accessed
456+
// via either native Promise.then or MutationObserver.
457+
// MutationObserver has wider support, however it is seriously bugged in
458+
// UIWebView in iOS >= 9.3.3 when triggered in touch event handlers. It
459+
// completely stops working after triggering a few times... so, if native
460+
// Promise is available, we will use it:
461+
/* istanbul ignore if */
462+
if (typeof Promise !== 'undefined' && isNative(Promise)) {
463+
var p = Promise.resolve();
464+
var noop = function noop() {};
465+
timerFunc = function () {
466+
p.then(nextTickHandler);
467+
// in problematic UIWebViews, Promise.then doesn't completely break, but
468+
// it can get stuck in a weird state where callbacks are pushed into the
469+
// microtask queue but the queue isn't being flushed, until the browser
470+
// needs to do some other work, e.g. handle a timer. Therefore we can
471+
// "force" the microtask queue to be flushed by adding an empty timer.
472+
if (isIOS) setTimeout(noop);
473+
};
474+
} else if (typeof MutationObserver !== 'undefined') {
475+
// use MutationObserver where native Promise is not available,
476+
// e.g. IE11, iOS7, Android 4.4
477+
var counter = 1;
478+
var observer = new MutationObserver(nextTickHandler);
479+
var textNode = document.createTextNode(String(counter));
480+
observer.observe(textNode, {
481+
characterData: true
482+
});
483+
timerFunc = function () {
484+
counter = (counter + 1) % 2;
485+
textNode.data = String(counter);
486+
};
487+
} else {
488+
// fallback to setTimeout
489+
/* istanbul ignore next */
490+
timerFunc = setTimeout;
464491
}
465492

466493
return function (cb, ctx) {
@@ -476,7 +503,7 @@ var nextTick = (function () {
476503

477504
var _Set = undefined;
478505
/* istanbul ignore if */
479-
if (typeof Set !== 'undefined' && Set.toString().match(/native code/)) {
506+
if (typeof Set !== 'undefined' && isNative(Set)) {
480507
// use native Set when available.
481508
_Set = Set;
482509
} else {
@@ -1638,24 +1665,6 @@ function getOuterHTML(el) {
16381665
}
16391666
}
16401667

1641-
/**
1642-
* Find a vm from a fragment.
1643-
*
1644-
* @param {Fragment} frag
1645-
* @return {Vue|undefined}
1646-
*/
1647-
1648-
function findVmFromFrag(frag) {
1649-
var node = frag.node;
1650-
// handle multi-node frag
1651-
if (frag.end) {
1652-
while (!node.__vue__ && node !== frag.end && node.nextSibling) {
1653-
node = node.nextSibling;
1654-
}
1655-
}
1656-
return node.__vue__;
1657-
}
1658-
16591668
var commonTagRE = /^(div|p|span|img|a|b|i|br|ul|ol|li|h1|h2|h3|h4|h5|h6|code|pre|table|th|td|tr|form|label|input|select|option|nav|article|section|header|footer)$/i;
16601669
var reservedTagRE = /^(slot|partial|component)$/i;
16611670

@@ -2439,6 +2448,7 @@ var util = Object.freeze({
24392448
isIE: isIE,
24402449
isIE9: isIE9,
24412450
isAndroid: isAndroid,
2451+
isIOS: isIOS,
24422452
get transitionProp () { return transitionProp; },
24432453
get transitionEndEvent () { return transitionEndEvent; },
24442454
get animationProp () { return animationProp; },
@@ -2469,7 +2479,6 @@ var util = Object.freeze({
24692479
removeNodeRange: removeNodeRange,
24702480
isFragment: isFragment,
24712481
getOuterHTML: getOuterHTML,
2472-
findVmFromFrag: findVmFromFrag,
24732482
mergeOptions: mergeOptions,
24742483
resolveAsset: resolveAsset,
24752484
checkComponentAttr: checkComponentAttr,
@@ -4105,6 +4114,10 @@ var vFor = {
41054114
params: ['track-by', 'stagger', 'enter-stagger', 'leave-stagger'],
41064115

41074116
bind: function bind() {
4117+
if ('development' !== 'production' && this.el.hasAttribute('v-if')) {
4118+
warn('<' + this.el.tagName.toLowerCase() + ' v-for="' + this.expression + '" v-if="' + this.el.getAttribute('v-if') + '">: ' + 'Using v-if and v-for on the same element is not recommended - ' + 'consider filtering the source Array instead.', this.vm);
4119+
}
4120+
41084121
// support "item in/of items" syntax
41094122
var inMatch = this.expression.match(/(.*) (?:in|of) (.*)/);
41104123
if (inMatch) {
@@ -4684,6 +4697,24 @@ if ('development' !== 'production') {
46844697
};
46854698
}
46864699

4700+
/**
4701+
* Find a vm from a fragment.
4702+
*
4703+
* @param {Fragment} frag
4704+
* @return {Vue|undefined}
4705+
*/
4706+
4707+
function findVmFromFrag(frag) {
4708+
var node = frag.node;
4709+
// handle multi-node frag
4710+
if (frag.end) {
4711+
while (!node.__vue__ && node !== frag.end && node.nextSibling) {
4712+
node = node.nextSibling;
4713+
}
4714+
}
4715+
return node.__vue__;
4716+
}
4717+
46874718
var vIf = {
46884719

46894720
priority: IF,
@@ -4712,10 +4743,8 @@ var vIf = {
47124743
if (value) {
47134744
if (!this.frag) {
47144745
this.insert();
4715-
this.updateRef(value);
47164746
}
47174747
} else {
4718-
this.updateRef(value);
47194748
this.remove();
47204749
}
47214750
},
@@ -4747,29 +4776,6 @@ var vIf = {
47474776
}
47484777
},
47494778

4750-
updateRef: function updateRef(value) {
4751-
var ref = this.descriptor.ref;
4752-
if (!ref) return;
4753-
var hash = (this.vm || this._scope).$refs;
4754-
var refs = hash[ref];
4755-
var key = this._frag.scope.$key;
4756-
if (!refs) return;
4757-
if (value) {
4758-
if (Array.isArray(refs)) {
4759-
refs.push(findVmFromFrag(this._frag));
4760-
} else {
4761-
refs[key] = findVmFromFrag(this._frag);
4762-
}
4763-
} else {
4764-
if (Array.isArray(refs)) {
4765-
refs.$remove(findVmFromFrag(this._frag));
4766-
} else {
4767-
refs[key] = null;
4768-
delete refs[key];
4769-
}
4770-
}
4771-
},
4772-
47734779
unbind: function unbind() {
47744780
if (this.frag) {
47754781
this.frag.destroy();
@@ -7061,18 +7067,20 @@ function sortDirectives(dirs) {
70617067

70627068
var groupedMap = {};
70637069
var i, j, k, l;
7070+
var index = 0;
7071+
var priorities = [];
70647072
for (i = 0, j = dirs.length; i < j; i++) {
70657073
var dir = dirs[i];
70667074
var priority = dir.descriptor.def.priority || DEFAULT_PRIORITY;
70677075
var array = groupedMap[priority];
70687076
if (!array) {
70697077
array = groupedMap[priority] = [];
7078+
priorities.push(priority);
70707079
}
70717080
array.push(dir);
70727081
}
70737082

7074-
var index = 0;
7075-
var priorities = Object.keys(groupedMap).sort(function (a, b) {
7083+
priorities.sort(function (a, b) {
70767084
return a > b ? -1 : a === b ? 0 : 1;
70777085
});
70787086
for (i = 0, j = priorities.length; i < j; i++) {
@@ -7594,7 +7602,7 @@ function makeTerminalNodeLinkFn(el, dirName, value, options, def, rawName, arg,
75947602
def: def
75957603
};
75967604
// check ref for v-for, v-if and router-view
7597-
if (dirName === 'for' || dirName === 'if' || dirName === 'router-view') {
7605+
if (dirName === 'for' || dirName === 'router-view') {
75987606
descriptor.ref = findRef(el);
75997607
}
76007608
var fn = function terminalNodeLinkFn(vm, el, host, scope, frag) {
@@ -10210,7 +10218,7 @@ function installGlobalAPI (Vue) {
1021010218

1021110219
installGlobalAPI(Vue);
1021210220

10213-
Vue.version = '1.0.27';
10221+
Vue.version = '1.0.28';
1021410222

1021510223
// devtools global hook
1021610224
/* istanbul ignore next */

themes/vue/source/js/vue.min.js

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)