+38
-9
lines changedFilter options
+38
-9
lines changed Original file line number Diff line number Diff line change
@@ -14,6 +14,7 @@ export const isIE9 = UA && UA.indexOf('msie 9.0') > 0
14
14
export const isEdge = UA && UA.indexOf('edge/') > 0
15
15
export const isAndroid = UA && UA.indexOf('android') > 0
16
16
export const isIOS = UA && /iphone|ipad|ipod|ios/.test(UA)
17
+
export const isChrome = UA && /chrome\/\d+/.test(UA) && !isEdge
17
18
18
19
// this needs to be lazy-evaled because vue may be required before
19
20
// vue-server-renderer can set VUE_ENV
Original file line number Diff line number Diff line change
@@ -5,7 +5,7 @@ import config from 'core/config'
5
5
import { patch } from 'web/runtime/patch'
6
6
import { extend, noop } from 'shared/util'
7
7
import { mountComponent } from 'core/instance/lifecycle'
8
-
import { devtools, inBrowser, isEdge } from 'core/util/index'
8
+
import { devtools, inBrowser, isChrome } from 'core/util/index'
9
9
import platformDirectives from 'web/runtime/directives/index'
10
10
import platformComponents from 'web/runtime/components/index'
11
11
@@ -45,10 +45,7 @@ setTimeout(() => {
45
45
if (config.devtools) {
46
46
if (devtools) {
47
47
devtools.emit('init', Vue)
48
-
} else if (
49
-
process.env.NODE_ENV !== 'production' &&
50
-
inBrowser && !isEdge && /Chrome\/\d+/.test(window.navigator.userAgent)
51
-
) {
48
+
} else if (process.env.NODE_ENV !== 'production' && isChrome) {
52
49
console[console.info ? 'info' : 'log'](
53
50
'Download the Vue Devtools extension for a better development experience:\n' +
54
51
'https://github.com/vuejs/vue-devtools'
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
1
1
/* @flow */
2
2
3
3
import config from 'core/config'
4
-
import { isIE } from 'core/util/env'
5
4
import { addHandler, addProp, getBindingAttr } from 'compiler/helpers'
6
5
import { genComponentModel, genAssignmentCode } from 'compiler/directives/model'
7
6
8
7
let warn
9
8
9
+
// in some cases, the event used has to be determined at runtime
10
+
// so we used some reserved tokens during compile.
11
+
export const RANGE_TOKEN = '__r'
12
+
export const CHECKBOX_RADIO_TOKEN = '__c'
13
+
10
14
export default function model (
11
15
el: ASTElement,
12
16
dir: ASTDirective,
@@ -86,7 +90,7 @@ function genCheckboxModel (
86
90
: `:_q(${value},${trueValueBinding})`
87
91
)
88
92
)
89
-
addHandler(el, 'click',
93
+
addHandler(el, CHECKBOX_RADIO_TOKEN,
90
94
`var $$a=${value},` +
91
95
'$$el=$event.target,' +
92
96
`$$c=$$el.checked?(${trueValueBinding}):(${falseValueBinding});` +
@@ -117,7 +121,7 @@ function genRadioModel (
117
121
let valueBinding = getBindingAttr(el, 'value') || 'null'
118
122
valueBinding = number ? `_n(${valueBinding})` : valueBinding
119
123
addProp(el, 'checked', `_q(${value},${valueBinding})`)
120
-
addHandler(el, 'click', genAssignmentCode(value, valueBinding), null, true)
124
+
addHandler(el, CHECKBOX_RADIO_TOKEN, genAssignmentCode(value, valueBinding), null, true)
121
125
}
122
126
123
127
function genSelect (
@@ -162,8 +166,12 @@ function genDefaultModel (
162
166
): ?boolean {
163
167
const type = el.attrsMap.type
164
168
const { lazy, number, trim } = modifiers || {}
165
-
const event = lazy || (isIE && type === 'range') ? 'change' : 'input'
166
169
const needCompositionGuard = !lazy && type !== 'range'
170
+
const event = lazy
171
+
? 'change'
172
+
: type === 'range'
173
+
? RANGE_TOKEN
174
+
: 'input'
167
175
168
176
let valueExpression = '$event.target.value'
169
177
if (trim) {
Original file line number Diff line number Diff line change
@@ -1,6 +1,28 @@
1
1
/* @flow */
2
2
3
+
import { isChrome, isIE } from 'core/util/env'
3
4
import { updateListeners } from 'core/vdom/helpers/index'
5
+
import { RANGE_TOKEN, CHECKBOX_RADIO_TOKEN } from 'web/compiler/directives/model'
6
+
7
+
// normalize v-model event tokens that can only be determined at runtime.
8
+
// it's important to place the event as the first in the array because
9
+
// the whole point is ensuring the v-model callback gets called before
10
+
// user-attached handlers.
11
+
function normalizeEvents (on) {
12
+
let event
13
+
if (on[RANGE_TOKEN]) {
14
+
// IE input[type=range] only supports `change` event
15
+
event = isIE ? 'change' : 'input'
16
+
on[event] = [].concat(on[RANGE_TOKEN], on[event] || [])
17
+
delete on[RANGE_TOKEN]
18
+
}
19
+
if (on[CHECKBOX_RADIO_TOKEN]) {
20
+
// Chrome fires microtasks in between click/change, leads to #4521
21
+
event = isChrome ? 'click' : 'change'
22
+
on[event] = [].concat(on[CHECKBOX_RADIO_TOKEN], on[event] || [])
23
+
delete on[CHECKBOX_RADIO_TOKEN]
24
+
}
25
+
}
4
26
5
27
let target: HTMLElement
6
28
@@ -41,6 +63,7 @@ function updateDOMListeners (oldVnode: VNodeWithData, vnode: VNodeWithData) {
41
63
const on = vnode.data.on || {}
42
64
const oldOn = oldVnode.data.on || {}
43
65
target = vnode.elm
66
+
normalizeEvents(on)
44
67
updateListeners(on, oldOn, add, remove, vnode.context)
45
68
}
46
69
You can’t perform that action at this time.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4