Skip to content

Commit ccd44f3

Browse files
committed
[build] 2.0.0-rc.8
1 parent 310f5a2 commit ccd44f3

File tree

8 files changed

+214
-77
lines changed

8 files changed

+214
-77
lines changed

dist/vue.common.js

Lines changed: 46 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -355,6 +355,7 @@ function parsePath (path) {
355355
}
356356

357357
/* */
358+
/* globals MutationObserver */
358359

359360
// can we use __proto__?
360361
var hasProto = '__proto__' in {}
@@ -369,10 +370,16 @@ var isIE = UA && /msie|trident/.test(UA)
369370
var isIE9 = UA && UA.indexOf('msie 9.0') > 0
370371
var isEdge = UA && UA.indexOf('edge/') > 0
371372
var isAndroid = UA && UA.indexOf('android') > 0
373+
var isIOS = UA && /iphone|ipad|ipod|ios/.test(UA)
372374

373375
// detect devtools
374376
var devtools = inBrowser && window.__VUE_DEVTOOLS_GLOBAL_HOOK__
375377

378+
/* istanbul ignore next */
379+
function isNative (Ctor) {
380+
return /native code/.test(Ctor.toString())
381+
}
382+
376383
/**
377384
* Defer a task to execute it asynchronously. Ideally this
378385
* should be executed as a microtask, but MutationObserver is unreliable
@@ -386,44 +393,64 @@ var nextTick = (function () {
386393
function nextTickHandler () {
387394
pending = false
388395
var copies = callbacks.slice(0)
389-
callbacks = []
396+
callbacks.length = 0
390397
for (var i = 0; i < copies.length; i++) {
391398
copies[i]()
392399
}
393400
}
394401

395-
/* istanbul ignore else */
396-
if (inBrowser && window.postMessage &&
397-
!window.importScripts && // not in WebWorker
398-
!(isAndroid && !window.requestAnimationFrame) // not in Android <= 4.3
399-
) {
400-
var NEXT_TICK_TOKEN = '__vue__nextTick__'
401-
window.addEventListener('message', function (e) {
402-
if (e.source === window && e.data === NEXT_TICK_TOKEN) {
403-
nextTickHandler()
404-
}
402+
// the nextTick behavior leverages the microtask queue, which can be accessed
403+
// via either native Promise.then or MutationObserver.
404+
// MutationObserver has wider support, however it is seriously bugged in
405+
// UIWebView in iOS >= 9.3.3 when triggered in touch event handlers. It
406+
// completely stops working after triggering a few times... so, if native
407+
// Promise is available, we will use it:
408+
/* istanbul ignore if */
409+
if (typeof Promise !== 'undefined' && isNative(Promise)) {
410+
var p = Promise.resolve()
411+
timerFunc = function () {
412+
p.then(nextTickHandler)
413+
// in problematic UIWebViews, Promise.then doesn't completely break, but
414+
// it can get stuck in a weird state where callbacks are pushed into the
415+
// microtask queue but the queue isn't being flushed, until the browser
416+
// needs to do some other work, e.g. handle a timer. Therefore we can
417+
// "force" the microtask queue to be flushed by adding an empty timer.
418+
if (isIOS) { setTimeout(noop) }
419+
}
420+
} else if (typeof MutationObserver !== 'undefined') {
421+
// use MutationObserver where native Promise is not available,
422+
// e.g. IE11, iOS7, Android 4.4
423+
var counter = 1
424+
var observer = new MutationObserver(nextTickHandler)
425+
var textNode = document.createTextNode(String(counter))
426+
observer.observe(textNode, {
427+
characterData: true
405428
})
406429
timerFunc = function () {
407-
window.postMessage(NEXT_TICK_TOKEN, '*')
430+
counter = (counter + 1) % 2
431+
textNode.data = String(counter)
408432
}
409433
} else {
410-
timerFunc = (typeof global !== 'undefined' && global.setImmediate) || setTimeout
434+
// fallback to setTimeout
435+
/* istanbul ignore next */
436+
timerFunc = setTimeout
411437
}
412438

413439
return function queueNextTick (cb, ctx) {
414440
var func = ctx
415441
? function () { cb.call(ctx) }
416442
: cb
417443
callbacks.push(func)
418-
if (pending) { return }
419-
pending = true
420-
timerFunc(nextTickHandler, 0)
444+
if (!pending) {
445+
pending = true
446+
timerFunc(nextTickHandler, 0)
447+
}
421448
}
422449
})()
423450

424451
var _Set
425452
/* istanbul ignore if */
426-
if (typeof Set !== 'undefined' && /native code/.test(Set.toString())) {
453+
if (typeof Set !== 'undefined' && isNative(Set)) {
427454
// use native Set when available.
428455
_Set = Set
429456
} else {
@@ -3078,6 +3105,7 @@ var util = Object.freeze({
30783105
isIE9: isIE9,
30793106
isEdge: isEdge,
30803107
isAndroid: isAndroid,
3108+
isIOS: isIOS,
30813109
devtools: devtools,
30823110
nextTick: nextTick,
30833111
get _Set () { return _Set; },
@@ -3297,7 +3325,7 @@ Object.defineProperty(Vue.prototype, '$isServer', {
32973325
get: function () { return config._isServer; }
32983326
})
32993327

3300-
Vue.version = '2.0.0-rc.7'
3328+
Vue.version = '2.0.0-rc.8'
33013329

33023330
/* */
33033331

dist/vue.js

Lines changed: 56 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*!
2-
* Vue.js v2.0.0-rc.7
2+
* Vue.js v2.0.0-rc.8
33
* (c) 2014-2016 Evan You
44
* Released under the MIT License.
55
*/
@@ -364,6 +364,7 @@ function parsePath (path) {
364364
}
365365

366366
/* */
367+
/* globals MutationObserver */
367368

368369
// can we use __proto__?
369370
var hasProto = '__proto__' in {}
@@ -378,10 +379,16 @@ var isIE = UA && /msie|trident/.test(UA)
378379
var isIE9 = UA && UA.indexOf('msie 9.0') > 0
379380
var isEdge = UA && UA.indexOf('edge/') > 0
380381
var isAndroid = UA && UA.indexOf('android') > 0
382+
var isIOS = UA && /iphone|ipad|ipod|ios/.test(UA)
381383

382384
// detect devtools
383385
var devtools = inBrowser && window.__VUE_DEVTOOLS_GLOBAL_HOOK__
384386

387+
/* istanbul ignore next */
388+
function isNative (Ctor) {
389+
return /native code/.test(Ctor.toString())
390+
}
391+
385392
/**
386393
* Defer a task to execute it asynchronously. Ideally this
387394
* should be executed as a microtask, but MutationObserver is unreliable
@@ -395,44 +402,64 @@ var nextTick = (function () {
395402
function nextTickHandler () {
396403
pending = false
397404
var copies = callbacks.slice(0)
398-
callbacks = []
405+
callbacks.length = 0
399406
for (var i = 0; i < copies.length; i++) {
400407
copies[i]()
401408
}
402409
}
403410

404-
/* istanbul ignore else */
405-
if (inBrowser && window.postMessage &&
406-
!window.importScripts && // not in WebWorker
407-
!(isAndroid && !window.requestAnimationFrame) // not in Android <= 4.3
408-
) {
409-
var NEXT_TICK_TOKEN = '__vue__nextTick__'
410-
window.addEventListener('message', function (e) {
411-
if (e.source === window && e.data === NEXT_TICK_TOKEN) {
412-
nextTickHandler()
413-
}
411+
// the nextTick behavior leverages the microtask queue, which can be accessed
412+
// via either native Promise.then or MutationObserver.
413+
// MutationObserver has wider support, however it is seriously bugged in
414+
// UIWebView in iOS >= 9.3.3 when triggered in touch event handlers. It
415+
// completely stops working after triggering a few times... so, if native
416+
// Promise is available, we will use it:
417+
/* istanbul ignore if */
418+
if (typeof Promise !== 'undefined' && isNative(Promise)) {
419+
var p = Promise.resolve()
420+
timerFunc = function () {
421+
p.then(nextTickHandler)
422+
// in problematic UIWebViews, Promise.then doesn't completely break, but
423+
// it can get stuck in a weird state where callbacks are pushed into the
424+
// microtask queue but the queue isn't being flushed, until the browser
425+
// needs to do some other work, e.g. handle a timer. Therefore we can
426+
// "force" the microtask queue to be flushed by adding an empty timer.
427+
if (isIOS) { setTimeout(noop) }
428+
}
429+
} else if (typeof MutationObserver !== 'undefined') {
430+
// use MutationObserver where native Promise is not available,
431+
// e.g. IE11, iOS7, Android 4.4
432+
var counter = 1
433+
var observer = new MutationObserver(nextTickHandler)
434+
var textNode = document.createTextNode(String(counter))
435+
observer.observe(textNode, {
436+
characterData: true
414437
})
415438
timerFunc = function () {
416-
window.postMessage(NEXT_TICK_TOKEN, '*')
439+
counter = (counter + 1) % 2
440+
textNode.data = String(counter)
417441
}
418442
} else {
419-
timerFunc = (typeof global !== 'undefined' && global.setImmediate) || setTimeout
443+
// fallback to setTimeout
444+
/* istanbul ignore next */
445+
timerFunc = setTimeout
420446
}
421447

422448
return function queueNextTick (cb, ctx) {
423449
var func = ctx
424450
? function () { cb.call(ctx) }
425451
: cb
426452
callbacks.push(func)
427-
if (pending) { return }
428-
pending = true
429-
timerFunc(nextTickHandler, 0)
453+
if (!pending) {
454+
pending = true
455+
timerFunc(nextTickHandler, 0)
456+
}
430457
}
431458
})()
432459

433460
var _Set
434461
/* istanbul ignore if */
435-
if (typeof Set !== 'undefined' && /native code/.test(Set.toString())) {
462+
if (typeof Set !== 'undefined' && isNative(Set)) {
436463
// use native Set when available.
437464
_Set = Set
438465
} else {
@@ -3083,6 +3110,7 @@ var util = Object.freeze({
30833110
isIE9: isIE9,
30843111
isEdge: isEdge,
30853112
isAndroid: isAndroid,
3113+
isIOS: isIOS,
30863114
devtools: devtools,
30873115
nextTick: nextTick,
30883116
get _Set () { return _Set; },
@@ -3302,7 +3330,7 @@ Object.defineProperty(Vue.prototype, '$isServer', {
33023330
get: function () { return config._isServer; }
33033331
})
33043332

3305-
Vue.version = '2.0.0-rc.7'
3333+
Vue.version = '2.0.0-rc.8'
33063334

33073335
/* */
33083336

@@ -7125,6 +7153,15 @@ function genDefaultModel (
71257153
if (isNative && needCompositionGuard) {
71267154
code = "if($event.target.composing)return;" + code
71277155
}
7156+
// inputs with type="file" are read only and setting the input's
7157+
// value will throw an error.
7158+
if ("development" !== 'production' &&
7159+
type === 'file') {
7160+
warn$3(
7161+
"<" + (el.tag) + " v-model=\"" + value + "\" type=\"file\">:\n" +
7162+
"File inputs are read only. Use a v-on:change listener instead."
7163+
)
7164+
}
71287165
addProp(el, 'value', isNative ? ("_s(" + value + ")") : ("(" + value + ")"))
71297166
addHandler(el, event, code, null, true)
71307167
if (needCompositionGuard) {

dist/vue.min.js

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

packages/vue-server-renderer/build.js

Lines changed: 53 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -355,6 +355,7 @@ function looseIndexOf (arr, val) {
355355
}
356356

357357
/* */
358+
/* globals MutationObserver */
358359

359360
// can we use __proto__?
360361
var hasProto = '__proto__' in {}
@@ -369,10 +370,16 @@ var isIE = UA && /msie|trident/.test(UA)
369370
var isIE9 = UA && UA.indexOf('msie 9.0') > 0
370371
var isEdge = UA && UA.indexOf('edge/') > 0
371372
var isAndroid = UA && UA.indexOf('android') > 0
373+
var isIOS = UA && /iphone|ipad|ipod|ios/.test(UA)
372374

373375
// detect devtools
374376
var devtools = inBrowser && window.__VUE_DEVTOOLS_GLOBAL_HOOK__
375377

378+
/* istanbul ignore next */
379+
function isNative (Ctor) {
380+
return /native code/.test(Ctor.toString())
381+
}
382+
376383
/**
377384
* Defer a task to execute it asynchronously. Ideally this
378385
* should be executed as a microtask, but MutationObserver is unreliable
@@ -386,44 +393,64 @@ var nextTick = (function () {
386393
function nextTickHandler () {
387394
pending = false
388395
var copies = callbacks.slice(0)
389-
callbacks = []
396+
callbacks.length = 0
390397
for (var i = 0; i < copies.length; i++) {
391398
copies[i]()
392399
}
393400
}
394401

395-
/* istanbul ignore else */
396-
if (inBrowser && window.postMessage &&
397-
!window.importScripts && // not in WebWorker
398-
!(isAndroid && !window.requestAnimationFrame) // not in Android <= 4.3
399-
) {
400-
var NEXT_TICK_TOKEN = '__vue__nextTick__'
401-
window.addEventListener('message', function (e) {
402-
if (e.source === window && e.data === NEXT_TICK_TOKEN) {
403-
nextTickHandler()
404-
}
402+
// the nextTick behavior leverages the microtask queue, which can be accessed
403+
// via either native Promise.then or MutationObserver.
404+
// MutationObserver has wider support, however it is seriously bugged in
405+
// UIWebView in iOS >= 9.3.3 when triggered in touch event handlers. It
406+
// completely stops working after triggering a few times... so, if native
407+
// Promise is available, we will use it:
408+
/* istanbul ignore if */
409+
if (typeof Promise !== 'undefined' && isNative(Promise)) {
410+
var p = Promise.resolve()
411+
timerFunc = function () {
412+
p.then(nextTickHandler)
413+
// in problematic UIWebViews, Promise.then doesn't completely break, but
414+
// it can get stuck in a weird state where callbacks are pushed into the
415+
// microtask queue but the queue isn't being flushed, until the browser
416+
// needs to do some other work, e.g. handle a timer. Therefore we can
417+
// "force" the microtask queue to be flushed by adding an empty timer.
418+
if (isIOS) { setTimeout(noop) }
419+
}
420+
} else if (typeof MutationObserver !== 'undefined') {
421+
// use MutationObserver where native Promise is not available,
422+
// e.g. IE11, iOS7, Android 4.4
423+
var counter = 1
424+
var observer = new MutationObserver(nextTickHandler)
425+
var textNode = document.createTextNode(String(counter))
426+
observer.observe(textNode, {
427+
characterData: true
405428
})
406429
timerFunc = function () {
407-
window.postMessage(NEXT_TICK_TOKEN, '*')
430+
counter = (counter + 1) % 2
431+
textNode.data = String(counter)
408432
}
409433
} else {
410-
timerFunc = (typeof global !== 'undefined' && global.setImmediate) || setTimeout
434+
// fallback to setTimeout
435+
/* istanbul ignore next */
436+
timerFunc = setTimeout
411437
}
412438

413439
return function queueNextTick (cb, ctx) {
414440
var func = ctx
415441
? function () { cb.call(ctx) }
416442
: cb
417443
callbacks.push(func)
418-
if (pending) { return }
419-
pending = true
420-
timerFunc(nextTickHandler, 0)
444+
if (!pending) {
445+
pending = true
446+
timerFunc(nextTickHandler, 0)
447+
}
421448
}
422449
})()
423450

424451
var _Set
425452
/* istanbul ignore if */
426-
if (typeof Set !== 'undefined' && /native code/.test(Set.toString())) {
453+
if (typeof Set !== 'undefined' && isNative(Set)) {
427454
// use native Set when available.
428455
_Set = Set
429456
} else {
@@ -4957,6 +4984,15 @@ function genDefaultModel (
49574984
if (isNative && needCompositionGuard) {
49584985
code = "if($event.target.composing)return;" + code
49594986
}
4987+
// inputs with type="file" are read only and setting the input's
4988+
// value will throw an error.
4989+
if (process.env.NODE_ENV !== 'production' &&
4990+
type === 'file') {
4991+
warn$3(
4992+
"<" + (el.tag) + " v-model=\"" + value + "\" type=\"file\">:\n" +
4993+
"File inputs are read only. Use a v-on:change listener instead."
4994+
)
4995+
}
49604996
addProp(el, 'value', isNative ? ("_s(" + value + ")") : ("(" + value + ")"))
49614997
addHandler(el, event, code, null, true)
49624998
if (needCompositionGuard) {

0 commit comments

Comments
 (0)