feat: support v-bind .prop & .attr modifiers
Also allows render function usage like the following:
```js
h({
'.prop': 1, // force set as property
'^attr': 'foo' // force set as attribute
})
```
This commit is contained in:
@@ -171,6 +171,20 @@ describe('runtime-dom: props patching', () => {
|
||||
patchProp(el, 'type', 'text', null)
|
||||
})
|
||||
|
||||
test('force patch as prop', () => {
|
||||
const el = document.createElement('div') as any
|
||||
patchProp(el, '.x', null, 1)
|
||||
expect(el.x).toBe(1)
|
||||
})
|
||||
|
||||
test('force patch as attribute', () => {
|
||||
const el = document.createElement('div') as any
|
||||
el.x = 1
|
||||
patchProp(el, '^x', null, 2)
|
||||
expect(el.x).toBe(1)
|
||||
expect(el.getAttribute('x')).toBe('2')
|
||||
})
|
||||
|
||||
test('input with size', () => {
|
||||
const el = document.createElement('input')
|
||||
patchProp(el, 'size', null, 100)
|
||||
|
||||
Reference in New Issue
Block a user