mirror of https://github.com/vuejs/vue.git
parent
96a09aad99
commit
7bc88f30c3
|
|
@ -15,6 +15,7 @@ export const isAndroid = (UA && UA.indexOf('android') > 0) || (weexPlatform ===
|
||||||
export const isIOS = (UA && /iphone|ipad|ipod|ios/.test(UA)) || (weexPlatform === 'ios')
|
export const isIOS = (UA && /iphone|ipad|ipod|ios/.test(UA)) || (weexPlatform === 'ios')
|
||||||
export const isChrome = UA && /chrome\/\d+/.test(UA) && !isEdge
|
export const isChrome = UA && /chrome\/\d+/.test(UA) && !isEdge
|
||||||
export const isPhantomJS = UA && /phantomjs/.test(UA)
|
export const isPhantomJS = UA && /phantomjs/.test(UA)
|
||||||
|
export const isFF = UA && UA.match(/firefox\/(\d+)/)
|
||||||
|
|
||||||
// Firefox has a "watch" function on Object.prototype...
|
// Firefox has a "watch" function on Object.prototype...
|
||||||
export const nativeWatch = ({}).watch
|
export const nativeWatch = ({}).watch
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
import { isDef, isUndef } from 'shared/util'
|
import { isDef, isUndef } from 'shared/util'
|
||||||
import { updateListeners } from 'core/vdom/helpers/index'
|
import { updateListeners } from 'core/vdom/helpers/index'
|
||||||
import { isIE, supportsPassive, isUsingMicroTask } from 'core/util/index'
|
import { isIE, isFF, supportsPassive, isUsingMicroTask } from 'core/util/index'
|
||||||
import { RANGE_TOKEN, CHECKBOX_RADIO_TOKEN } from 'web/compiler/directives/model'
|
import { RANGE_TOKEN, CHECKBOX_RADIO_TOKEN } from 'web/compiler/directives/model'
|
||||||
import { currentFlushTimestamp } from 'core/observer/scheduler'
|
import { currentFlushTimestamp } from 'core/observer/scheduler'
|
||||||
|
|
||||||
|
|
@ -39,6 +39,11 @@ function createOnceHandler (event, handler, capture) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// #9446: Firefox <= 53 (in particular, ESR 52) has incorrect Event.timeStamp
|
||||||
|
// implementation and does not fire microtasks in between event propagation, so
|
||||||
|
// safe to exclude.
|
||||||
|
const useMicrotaskFix = isUsingMicroTask && !(isFF && Number(isFF[1]) <= 53)
|
||||||
|
|
||||||
function add (
|
function add (
|
||||||
name: string,
|
name: string,
|
||||||
handler: Function,
|
handler: Function,
|
||||||
|
|
@ -51,7 +56,7 @@ function add (
|
||||||
// the solution is simple: we save the timestamp when a handler is attached,
|
// the solution is simple: we save the timestamp when a handler is attached,
|
||||||
// and the handler would only fire if the event passed to it was fired
|
// and the handler would only fire if the event passed to it was fired
|
||||||
// AFTER it was attached.
|
// AFTER it was attached.
|
||||||
if (isUsingMicroTask) {
|
if (useMicrotaskFix) {
|
||||||
const attachedTimestamp = currentFlushTimestamp
|
const attachedTimestamp = currentFlushTimestamp
|
||||||
const original = handler
|
const original = handler
|
||||||
handler = original._wrapper = function (e) {
|
handler = original._wrapper = function (e) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue