File tree Expand file tree Collapse file tree 1 file changed +16
-5
lines changed Expand file tree Collapse file tree 1 file changed +16
-5
lines changed Original file line number Diff line number Diff line change @@ -34,15 +34,26 @@ function isTrue (v) {
3434 return v === true
3535}
3636
37- function sameVnode ( vnode1 , vnode2 ) {
37+ function sameVnode ( a , b ) {
3838 return (
39- vnode1 . key === vnode2 . key &&
40- vnode1 . tag === vnode2 . tag &&
41- vnode1 . isComment === vnode2 . isComment &&
42- ! vnode1 . data === ! vnode2 . data
39+ a . key === b . key &&
40+ a . tag === b . tag &&
41+ a . isComment === b . isComment &&
42+ isDef ( a . data ) === isDef ( b . data ) &&
43+ sameInputType ( a , b )
4344 )
4445}
4546
47+ // Some browsers do not support dynamically changing type for <input>
48+ // so they need to be treated as different nodes
49+ function sameInputType ( a , b ) {
50+ if ( a . tag !== 'input' ) return true
51+ let i
52+ const typeA = isDef ( i = a . data ) && isDef ( i = i . attrs ) && i . type
53+ const typeB = isDef ( i = b . data ) && isDef ( i = i . attrs ) && i . type
54+ return typeA === typeB
55+ }
56+
4657function createKeyToOldIdx ( children , beginIdx , endIdx ) {
4758 let i , key
4859 const map = { }
You can’t perform that action at this time.
0 commit comments