@@ -5,22 +5,18 @@ import { cached, isUndef } from 'shared/util'
5
5
6
6
const normalizeEvent = cached ( ( name : string ) : {
7
7
name : string ,
8
- plain : boolean ,
9
8
once : boolean ,
10
9
capture : boolean ,
11
- passive : boolean ,
12
- handler ?: Function
10
+ passive : boolean
13
11
} = > {
14
12
const passive = name . charAt ( 0 ) === '&'
15
13
name = passive ? name . slice ( 1 ) : name
16
14
const once = name . charAt ( 0 ) === '~' // Prefixed last, checked first
17
15
name = once ? name . slice ( 1 ) : name
18
16
const capture = name . charAt ( 0 ) === '!'
19
17
name = capture ? name . slice ( 1 ) : name
20
- const plain = ! ( passive || once || capture )
21
18
return {
22
19
name ,
23
- plain,
24
20
once,
25
21
capture,
26
22
passive
@@ -44,11 +40,6 @@ export function createFnInvoker (fns: Function | Array<Function>): Function {
44
40
return invoker
45
41
}
46
42
47
- // #6552
48
- function prioritizePlainEvents ( a , b ) {
49
- return a . plain ? - 1 : b . plain ? 1 : 0
50
- }
51
-
52
43
export function updateListeners (
53
44
on : Object ,
54
45
oldOn : Object ,
@@ -57,13 +48,10 @@ export function updateListeners (
57
48
vm : Component
58
49
) {
59
50
let name , cur , old , event
60
- const toAdd = [ ]
61
- let hasModifier = false
62
51
for ( name in on ) {
63
52
cur = on [ name ]
64
53
old = oldOn [ name ]
65
54
event = normalizeEvent ( name )
66
- if ( ! event . plain ) hasModifier = true
67
55
if ( isUndef ( cur ) ) {
68
56
process . env . NODE_ENV !== 'production' && warn (
69
57
`Invalid handler for event "${ event . name } ": got ` + String ( cur ) ,
@@ -73,20 +61,12 @@ export function updateListeners (
73
61
if ( isUndef ( cur . fns ) ) {
74
62
cur = on [ name ] = createFnInvoker ( cur )
75
63
}
76
- event . handler = cur
77
- toAdd . push ( event )
64
+ add ( event . name , cur , event . once , event . capture , event . passive )
78
65
} else if ( cur !== old ) {
79
66
old . fns = cur
80
67
on [ name ] = old
81
68
}
82
69
}
83
- if ( toAdd . length ) {
84
- if ( hasModifier ) toAdd . sort ( prioritizePlainEvents )
85
- for ( let i = 0 ; i < toAdd . length ; i ++ ) {
86
- const event = toAdd [ i ]
87
- add ( event . name , event . handler , event . once , event . capture , event . passive )
88
- }
89
- }
90
70
for ( name in oldOn ) {
91
71
if ( isUndef ( on [ name ] ) ) {
92
72
event = normalizeEvent ( name )
0 commit comments