Skip to content

Commit 941a2a3

Browse files
committed
[build] 1.0.28
1 parent 2268c51 commit 941a2a3

File tree

5 files changed

+160
-144
lines changed

5 files changed

+160
-144
lines changed

dist/vue.common.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
*/
@@ -401,6 +401,7 @@ var UA = inBrowser && window.navigator.userAgent.toLowerCase();
401401
var isIE = UA && UA.indexOf('trident') > 0;
402402
var isIE9 = UA && UA.indexOf('msie 9.0') > 0;
403403
var isAndroid = UA && UA.indexOf('android') > 0;
404+
var isIOS = UA && /iphone|ipad|ipod|ios/.test(UA);
404405

405406
var transitionProp = undefined;
406407
var transitionEndEvent = undefined;
@@ -417,6 +418,12 @@ if (inBrowser && !isIE9) {
417418
animationEndEvent = isWebkitAnim ? 'webkitAnimationEnd' : 'animationend';
418419
}
419420

421+
/* istanbul ignore next */
422+
function isNative(Ctor) {
423+
return (/native code/.test(Ctor.toString())
424+
);
425+
}
426+
420427
/**
421428
* Defer a task to execute it asynchronously. Ideally this
422429
* should be executed as a microtask, so we leverage
@@ -430,33 +437,53 @@ if (inBrowser && !isIE9) {
430437
var nextTick = (function () {
431438
var callbacks = [];
432439
var pending = false;
433-
var timerFunc;
440+
var timerFunc = undefined;
441+
434442
function nextTickHandler() {
435443
pending = false;
436444
var copies = callbacks.slice(0);
437-
callbacks = [];
445+
callbacks.length = 0;
438446
for (var i = 0; i < copies.length; i++) {
439447
copies[i]();
440448
}
441449
}
442450

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

462489
return function (cb, ctx) {
@@ -472,7 +499,7 @@ var nextTick = (function () {
472499

473500
var _Set = undefined;
474501
/* istanbul ignore if */
475-
if (typeof Set !== 'undefined' && Set.toString().match(/native code/)) {
502+
if (typeof Set !== 'undefined' && isNative(Set)) {
476503
// use native Set when available.
477504
_Set = Set;
478505
} else {
@@ -1634,24 +1661,6 @@ function getOuterHTML(el) {
16341661
}
16351662
}
16361663

1637-
/**
1638-
* Find a vm from a fragment.
1639-
*
1640-
* @param {Fragment} frag
1641-
* @return {Vue|undefined}
1642-
*/
1643-
1644-
function findVmFromFrag(frag) {
1645-
var node = frag.node;
1646-
// handle multi-node frag
1647-
if (frag.end) {
1648-
while (!node.__vue__ && node !== frag.end && node.nextSibling) {
1649-
node = node.nextSibling;
1650-
}
1651-
}
1652-
return node.__vue__;
1653-
}
1654-
16551664
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;
16561665
var reservedTagRE = /^(slot|partial|component)$/i;
16571666

@@ -2435,6 +2444,7 @@ var util = Object.freeze({
24352444
isIE: isIE,
24362445
isIE9: isIE9,
24372446
isAndroid: isAndroid,
2447+
isIOS: isIOS,
24382448
get transitionProp () { return transitionProp; },
24392449
get transitionEndEvent () { return transitionEndEvent; },
24402450
get animationProp () { return animationProp; },
@@ -2465,7 +2475,6 @@ var util = Object.freeze({
24652475
removeNodeRange: removeNodeRange,
24662476
isFragment: isFragment,
24672477
getOuterHTML: getOuterHTML,
2468-
findVmFromFrag: findVmFromFrag,
24692478
mergeOptions: mergeOptions,
24702479
resolveAsset: resolveAsset,
24712480
checkComponentAttr: checkComponentAttr,
@@ -4101,6 +4110,10 @@ var vFor = {
41014110
params: ['track-by', 'stagger', 'enter-stagger', 'leave-stagger'],
41024111

41034112
bind: function bind() {
4113+
if (process.env.NODE_ENV !== 'production' && this.el.hasAttribute('v-if')) {
4114+
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);
4115+
}
4116+
41044117
// support "item in/of items" syntax
41054118
var inMatch = this.expression.match(/(.*) (?:in|of) (.*)/);
41064119
if (inMatch) {
@@ -4680,6 +4693,24 @@ if (process.env.NODE_ENV !== 'production') {
46804693
};
46814694
}
46824695

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

46854716
priority: IF,
@@ -4708,10 +4739,8 @@ var vIf = {
47084739
if (value) {
47094740
if (!this.frag) {
47104741
this.insert();
4711-
this.updateRef(value);
47124742
}
47134743
} else {
4714-
this.updateRef(value);
47154744
this.remove();
47164745
}
47174746
},
@@ -4743,29 +4772,6 @@ var vIf = {
47434772
}
47444773
},
47454774

4746-
updateRef: function updateRef(value) {
4747-
var ref = this.descriptor.ref;
4748-
if (!ref) return;
4749-
var hash = (this.vm || this._scope).$refs;
4750-
var refs = hash[ref];
4751-
var key = this._frag.scope.$key;
4752-
if (!refs) return;
4753-
if (value) {
4754-
if (Array.isArray(refs)) {
4755-
refs.push(findVmFromFrag(this._frag));
4756-
} else {
4757-
refs[key] = findVmFromFrag(this._frag);
4758-
}
4759-
} else {
4760-
if (Array.isArray(refs)) {
4761-
refs.$remove(findVmFromFrag(this._frag));
4762-
} else {
4763-
refs[key] = null;
4764-
delete refs[key];
4765-
}
4766-
}
4767-
},
4768-
47694775
unbind: function unbind() {
47704776
if (this.frag) {
47714777
this.frag.destroy();
@@ -7064,18 +7070,20 @@ function sortDirectives(dirs) {
70647070

70657071
var groupedMap = {};
70667072
var i, j, k, l;
7073+
var index = 0;
7074+
var priorities = [];
70677075
for (i = 0, j = dirs.length; i < j; i++) {
70687076
var dir = dirs[i];
70697077
var priority = dir.descriptor.def.priority || DEFAULT_PRIORITY;
70707078
var array = groupedMap[priority];
70717079
if (!array) {
70727080
array = groupedMap[priority] = [];
7081+
priorities.push(priority);
70737082
}
70747083
array.push(dir);
70757084
}
70767085

7077-
var index = 0;
7078-
var priorities = Object.keys(groupedMap).sort(function (a, b) {
7086+
priorities.sort(function (a, b) {
70797087
return a > b ? -1 : a === b ? 0 : 1;
70807088
});
70817089
for (i = 0, j = priorities.length; i < j; i++) {
@@ -7597,7 +7605,7 @@ function makeTerminalNodeLinkFn(el, dirName, value, options, def, rawName, arg,
75977605
def: def
75987606
};
75997607
// check ref for v-for, v-if and router-view
7600-
if (dirName === 'for' || dirName === 'if' || dirName === 'router-view') {
7608+
if (dirName === 'for' || dirName === 'router-view') {
76017609
descriptor.ref = findRef(el);
76027610
}
76037611
var fn = function terminalNodeLinkFn(vm, el, host, scope, frag) {
@@ -10213,7 +10221,7 @@ function installGlobalAPI (Vue) {
1021310221

1021410222
installGlobalAPI(Vue);
1021510223

10216-
Vue.version = '1.0.27';
10224+
Vue.version = '1.0.28';
1021710225

1021810226
// devtools global hook
1021910227
/* istanbul ignore next */

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy