diff --git a/src/platforms/web/runtime/modules/attrs.js b/src/platforms/web/runtime/modules/attrs.js index b1946ec5c6..b5e0640305 100644 --- a/src/platforms/web/runtime/modules/attrs.js +++ b/src/platforms/web/runtime/modules/attrs.js @@ -98,8 +98,8 @@ function baseSetAttr (el, key, value) { /* istanbul ignore if */ if ( isIE && !isIE9 && - (el.tagName === 'TEXTAREA' || el.tagName === 'INPUT') && - key === 'placeholder' && !el.__ieph + el.tagName === 'TEXTAREA' && + key === 'placeholder' && value !== '' && !el.__ieph ) { const blocker = e => { e.stopImmediatePropagation() diff --git a/test/unit/features/directives/model-text.spec.js b/test/unit/features/directives/model-text.spec.js index 69e9851368..7cf5167461 100644 --- a/test/unit/features/directives/model-text.spec.js +++ b/test/unit/features/directives/model-text.spec.js @@ -437,8 +437,8 @@ describe('Directive v-model text', () => { }) } - // #7138 if (isIE && !isIE9) { + // #7138 it('should not fire input on initial render of textarea with placeholder in IE10/11', done => { const el = document.createElement('div') document.body.appendChild(el) @@ -452,5 +452,21 @@ describe('Directive v-model text', () => { done() }, 17) }) + + // #9042 + it('should not block the first input event when placeholder is empty', done => { + const el = document.createElement('div') + document.body.appendChild(el) + const vm = new Vue({ + el, + data: { evtCount: 0 }, + template: ``, + }) + triggerEvent(vm.$el, 'input') + setTimeout(() => { + expect(vm.evtCount).toBe(1) + done() + }, 17) + }) } })