This commit is contained in:
Tycho 2025-10-07 16:35:34 +03:00 committed by GitHub
commit 18765d3eb3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 13 additions and 0 deletions

View File

@ -394,4 +394,12 @@ describe('runtime-dom: props patching', () => {
expect(fn).toBeCalledTimes(0)
})
// #12211
test('should not override content when `text` attribute is set', () => {
const root = document.createElement('div')
render(h('a', { text: '' }, ['foo']), root)
const a = root.children[0]
expect(a.textContent).toBe('foo')
})
})

View File

@ -127,6 +127,11 @@ function shouldSetAsProp(
return false
}
// #12211 <a text> must be set as attribute
if (key === 'text' && el.tagName === 'A') {
return false
}
// #8780 the width or height of embedded tags must be set as attribute
if (key === 'width' || key === 'height') {
const tag = el.tagName