Skip to content

Commit b48c45e

Browse files
committed
ensure set value last in IE9 (fix vuejs#4391)
1 parent 4c3abdd commit b48c45e

File tree

1 file changed

+6
-1
lines changed
  • src/platforms/web/runtime/modules

1 file changed

+6
-1
lines changed

src/platforms/web/runtime/modules/attrs.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
/* @flow */
22

33
import { extend } from 'shared/util'
4+
import { isIE9 } from 'core/util/env'
45
import {
56
isBooleanAttr,
67
isEnumeratedAttr,
@@ -17,7 +18,7 @@ function updateAttrs (oldVnode: VNodeWithData, vnode: VNodeWithData) {
1718
let key, cur, old
1819
const elm = vnode.elm
1920
const oldAttrs = oldVnode.data.attrs || {}
20-
let attrs = vnode.data.attrs || {}
21+
let attrs: any = vnode.data.attrs || {}
2122
// clone observed objects, as the user probably wants to mutate it
2223
if (attrs.__ob__) {
2324
attrs = vnode.data.attrs = extend({}, attrs)
@@ -30,6 +31,10 @@ function updateAttrs (oldVnode: VNodeWithData, vnode: VNodeWithData) {
3031
setAttr(elm, key, cur)
3132
}
3233
}
34+
// #4391: in IE9, setting type can reset value for input[type=radio]
35+
if (isIE9 && attrs.value !== oldAttrs.value) {
36+
setAttr(elm, 'value', attrs.value)
37+
}
3338
for (key in oldAttrs) {
3439
if (attrs[key] == null) {
3540
if (isXlink(key)) {

0 commit comments

Comments
 (0)