Skip to content

Commit

Permalink
fix(runtime-dom): patch form as an attribute (#1788)
Browse files Browse the repository at this point in the history
Close #1787
  • Loading branch information
posva authored Aug 6, 2020
1 parent 2787c34 commit 00683fc
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
8 changes: 8 additions & 0 deletions packages/runtime-dom/__tests__/patchProps.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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')
})
})
6 changes: 6 additions & 0 deletions packages/runtime-dom/src/patchProp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 00683fc

Please sign in to comment.