Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
forked fromvuejs/vue

Commit62405aa

Browse files
committed
revert: fix(v-model): fix input listener with modifier blocking v-model update
This reverts commit6f312d6 because the changeis no longer needed after switching nextTick to use MessageChannel.
1 parent405d8e9 commit62405aa

File tree

2 files changed

+4
-29
lines changed

2 files changed

+4
-29
lines changed

‎src/core/vdom/helpers/update-listeners.js

Lines changed: 2 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -5,22 +5,18 @@ import { cached, isUndef } from 'shared/util'
55

66
constnormalizeEvent=cached((name:string):{
77
name:string,
8-
plain:boolean,
98
once:boolean,
109
capture:boolean,
11-
passive:boolean,
12-
handler?:Function
10+
passive:boolean
1311
}=>{
1412
const passive=name.charAt(0)==='&'
1513
name=passive ?name.slice(1) :name
1614
constonce=name.charAt(0)==='~'// Prefixed last, checked first
1715
name=once ?name.slice(1) :name
1816
constcapture=name.charAt(0)==='!'
1917
name=capture ?name.slice(1) :name
20-
constplain=!(passive||once||capture)
2118
return{
2219
name,
23-
plain,
2420
once,
2521
capture,
2622
passive
@@ -44,11 +40,6 @@ export function createFnInvoker (fns: Function | Array<Function>): Function {
4440
returninvoker
4541
}
4642

47-
// #6552
48-
functionprioritizePlainEvents(a,b){
49-
returna.plain ?-1 :b.plain ?1 :0
50-
}
51-
5243
exportfunctionupdateListeners(
5344
on:Object,
5445
oldOn:Object,
@@ -57,13 +48,10 @@ export function updateListeners (
5748
vm:Component
5849
){
5950
letname,cur,old,event
60-
consttoAdd=[]
61-
lethasModifier=false
6251
for(nameinon){
6352
cur=on[name]
6453
old=oldOn[name]
6554
event=normalizeEvent(name)
66-
if(!event.plain)hasModifier=true
6755
if(isUndef(cur)){
6856
process.env.NODE_ENV!=='production'&&warn(
6957
`Invalid handler for event "${event.name}": got `+String(cur),
@@ -73,20 +61,12 @@ export function updateListeners (
7361
if(isUndef(cur.fns)){
7462
cur=on[name]=createFnInvoker(cur)
7563
}
76-
event.handler=cur
77-
toAdd.push(event)
64+
add(event.name,cur,event.once,event.capture,event.passive)
7865
}elseif(cur!==old){
7966
old.fns=cur
8067
on[name]=old
8168
}
8269
}
83-
if(toAdd.length){
84-
if(hasModifier)toAdd.sort(prioritizePlainEvents)
85-
for(leti=0;i<toAdd.length;i++){
86-
constevent=toAdd[i]
87-
add(event.name,event.handler,event.once,event.capture,event.passive)
88-
}
89-
}
9070
for(nameinoldOn){
9171
if(isUndef(on[name])){
9272
event=normalizeEvent(name)

‎test/unit/features/directives/model-text.spec.js

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -315,13 +315,8 @@ describe('Directive v-model text', () => {
315315
})
316316

317317
// #6552
318-
// Root cause: input listeners with modifiers are added as a separate
319-
// DOM listener. If a change is triggered inside this listener, an update
320-
// will happen before the second listener is fired! (obviously microtasks
321-
// can be processed in between DOM events on the same element)
322-
// This causes the domProps module to receive state that has not been
323-
// updated by v-model yet (because v-model's listener has not fired yet)
324-
// Solution: make sure to always fire v-model's listener first
318+
// This was original introduced due to the microtask between DOM events issue
319+
// but fixed after switching to MessageChannel.
325320
it('should not block input when another input listener with modifier is used',done=>{
326321
constvm=newVue({
327322
data:{

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp