fix(runtime-dom): patch form as an attribute (#1788)

Close #1787
This commit is contained in:
Eduardo San Martin Morote 2020-08-06 15:32:28 +02:00 committed by GitHub
parent 2787c34cd4
commit 00683fce9a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 0 deletions

View File

@ -121,4 +121,12 @@ describe('runtime-dom: props patching', () => {
patchProp(el, 'id', null, '')
expect(el.hasAttribute('id')).toBe(true)
})
test('form attribute', () => {
const el = document.createElement('input')
patchProp(el, 'form', null, 'foo')
// non existant element
expect(el.form).toBe(null)
expect(el.getAttribute('form')).toBe('foo')
})
})

View File

@ -93,6 +93,12 @@ function shouldSetAsProp(
return false
}
// #1787 form as an attribute must be a string, while it accepts an Element as
// a prop
if (key === 'form' && typeof value === 'string') {
return false
}
// #1526 <input list> must be set as attribute
if (key === 'list' && el.tagName === 'INPUT') {
return false