From b48c45eb7ea8d6bdf1ec805fb4ade0576670e59a Mon Sep 17 00:00:00 2001 From: Evan You Date: Thu, 8 Dec 2016 12:12:11 -0500 Subject: [PATCH] ensure set value last in IE9 (fix #4391) --- src/platforms/web/runtime/modules/attrs.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/platforms/web/runtime/modules/attrs.js b/src/platforms/web/runtime/modules/attrs.js index 12d3aa02..cc3d695c 100644 --- a/src/platforms/web/runtime/modules/attrs.js +++ b/src/platforms/web/runtime/modules/attrs.js @@ -1,6 +1,7 @@ /* @flow */ import { extend } from 'shared/util' +import { isIE9 } from 'core/util/env' import { isBooleanAttr, isEnumeratedAttr, @@ -17,7 +18,7 @@ function updateAttrs (oldVnode: VNodeWithData, vnode: VNodeWithData) { let key, cur, old const elm = vnode.elm const oldAttrs = oldVnode.data.attrs || {} - let attrs = vnode.data.attrs || {} + let attrs: any = vnode.data.attrs || {} // clone observed objects, as the user probably wants to mutate it if (attrs.__ob__) { attrs = vnode.data.attrs = extend({}, attrs) @@ -30,6 +31,10 @@ function updateAttrs (oldVnode: VNodeWithData, vnode: VNodeWithData) { setAttr(elm, key, cur) } } + // #4391: in IE9, setting type can reset value for input[type=radio] + if (isIE9 && attrs.value !== oldAttrs.value) { + setAttr(elm, 'value', attrs.value) + } for (key in oldAttrs) { if (attrs[key] == null) { if (isXlink(key)) {