parent
1ce34e25d5
commit
e7b0a9d3cf
@ -10,6 +10,13 @@ describe('runtime-dom: attrs patching', () => {
|
|||||||
expect(el.getAttributeNS(xlinkNS, 'href')).toBe(null)
|
expect(el.getAttributeNS(xlinkNS, 'href')).toBe(null)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
test('textContent attributes /w svg', () => {
|
||||||
|
const el = document.createElementNS('http://www.w3.org/2000/svg', 'use')
|
||||||
|
patchProp(el, 'textContent', null, 'foo', true)
|
||||||
|
expect(el.attributes.length).toBe(0)
|
||||||
|
expect(el.innerHTML).toBe('foo')
|
||||||
|
})
|
||||||
|
|
||||||
test('boolean attributes', () => {
|
test('boolean attributes', () => {
|
||||||
const el = document.createElement('input')
|
const el = document.createElement('input')
|
||||||
patchProp(el, 'readonly', null, true)
|
patchProp(el, 'readonly', null, true)
|
||||||
|
@ -68,8 +68,8 @@ function shouldSetAsProp(
|
|||||||
) {
|
) {
|
||||||
if (isSVG) {
|
if (isSVG) {
|
||||||
// most keys must be set as attribute on svg elements to work
|
// most keys must be set as attribute on svg elements to work
|
||||||
// ...except innerHTML
|
// ...except innerHTML & textContent
|
||||||
if (key === 'innerHTML') {
|
if (key === 'innerHTML' || key === 'textContent') {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
// or native onclick with function values
|
// or native onclick with function values
|
||||||
|
Loading…
x
Reference in New Issue
Block a user