From 0f7c443dca800204bc2e00876365869ee79e2d7b Mon Sep 17 00:00:00 2001 From: Evan You Date: Mon, 27 Nov 2017 12:13:37 -0500 Subject: [PATCH] fix: block unnecessary input event on textarea placeholder in IE close #7138 --- src/platforms/web/runtime/modules/attrs.js | 20 +++++++++++++++++-- .../features/directives/model-text.spec.js | 19 +++++++++++++++++- 2 files changed, 36 insertions(+), 3 deletions(-) diff --git a/src/platforms/web/runtime/modules/attrs.js b/src/platforms/web/runtime/modules/attrs.js index 317316d8507..729802cdb4e 100644 --- a/src/platforms/web/runtime/modules/attrs.js +++ b/src/platforms/web/runtime/modules/attrs.js @@ -1,6 +1,6 @@ /* @flow */ -import { isIE9, isEdge } from 'core/util/env' +import { isIE, isIE9, isEdge } from 'core/util/env' import { extend, @@ -44,7 +44,7 @@ function updateAttrs (oldVnode: VNodeWithData, vnode: VNodeWithData) { // #4391: in IE9, setting type can reset value for input[type=radio] // #6666: IE/Edge forces progress value down to 1 before setting a max /* istanbul ignore if */ - if ((isIE9 || isEdge) && attrs.value !== oldAttrs.value) { + if ((isIE || isEdge) && attrs.value !== oldAttrs.value) { setAttr(elm, 'value', attrs.value) } for (key in oldAttrs) { @@ -84,6 +84,22 @@ function setAttr (el: Element, key: string, value: any) { if (isFalsyAttrValue(value)) { el.removeAttribute(key) } else { + // #7138: IE10 & 11 fires input event when setting placeholder on + // ` + }) + setTimeout(() => { + expect(vm.foo).toBe(null) + done() + }, 17) + }) + } })