Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(runtime-dom): ensure readonly type prop on textarea is handled patched as attribute (close #2766) #2888

Merged
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
7 changes: 7 additions & 0 deletions packages/runtime-dom/__tests__/patchProps.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -146,4 +146,11 @@ describe('runtime-dom: props patching', () => {
expect(el.form).toBe(null)
expect(el.getAttribute('form')).toBe('foo')
})

test('readonly type prop on textarea', () => {
const el = document.createElement('textarea')
// just to verify that it doesn't throw when i.e. switching a dynamic :is from an 'input' to a 'textarea'
// see https://github.com/vuejs/vue-next/issues/2766
patchProp(el, 'type', 'text', null)
})
})
5 changes: 5 additions & 0 deletions packages/runtime-dom/src/patchProp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,5 +109,10 @@ function shouldSetAsProp(
return false
}

// DOMprop "type" is readonly on textarea elements: https://github.com/vuejs/vue-next/issues/2766
if (key === 'type' && el.tagName === 'TEXTAREA') {
return false
}

return key in el
}