Browse Source

ensure set value last in IE9 (fix #4391)

Evan You 9 years ago
parent
commit
b48c45eb7e
1 changed files with 6 additions and 1 deletions
  1. 6 1
      src/platforms/web/runtime/modules/attrs.js

+ 6 - 1
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)) {