Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 0 additions & 17 deletions src/platforms/web/compiler/directives/model.js
Original file line number Diff line number Diff line change
Expand Up @@ -159,23 +159,6 @@ function genDefaultModel (
value: string,
modifiers: ?ASTModifiers
): ?boolean {
if (process.env.NODE_ENV !== 'production') {
if (el.tag === 'input' && el.attrsMap.value) {
warn(
`<${el.tag} v-model="${value}" value="${el.attrsMap.value}">:\n` +
'inline value attributes will be ignored when using v-model. ' +
'Declare initial values in the component\'s data option instead.'
)
}
if (el.tag === 'textarea' && el.children.length) {
warn(
`<textarea v-model="${value}">:\n` +
'inline content inside <textarea> will be ignored when using v-model. ' +
'Declare initial values in the component\'s data option instead.'
)
}
}

const type = el.attrsMap.type
const { lazy, number, trim } = modifiers || {}
const event = lazy || (isIE && type === 'range') ? 'change' : 'input'
Expand Down
24 changes: 0 additions & 24 deletions test/unit/features/directives/model-text.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -204,30 +204,6 @@ describe('Directive v-model text', () => {
})
}

it('warn inline value attribute', () => {
const vm = new Vue({
data: {
test: 'foo'
},
template: '<input v-model="test" value="bar">'
}).$mount()
expect(vm.test).toBe('foo')
expect(vm.$el.value).toBe('foo')
expect('inline value attributes will be ignored').toHaveBeenWarned()
})

it('warn textarea inline content', function () {
const vm = new Vue({
data: {
test: 'foo'
},
template: '<textarea v-model="test">bar</textarea>'
}).$mount()
expect(vm.test).toBe('foo')
expect(vm.$el.value).toBe('foo')
expect('inline content inside <textarea> will be ignored').toHaveBeenWarned()
})

it('warn invalid tag', () => {
new Vue({
data: {
Expand Down