Compare commits

...

4 Commits

Author SHA1 Message Date
Tycho 18765d3eb3
Merge e9c954f141 into c16f8a94c7 2025-10-07 16:35:34 +03:00
王二狗 c16f8a94c7
chore: fix typo. (#13948)
ci / test (push) Has been cancelled Details
ci / continuous-release (push) Has been cancelled Details
size data / upload (push) Has been cancelled Details
2025-10-04 09:46:30 +08:00
tycho e9c954f141 test: add test 2024-10-18 17:43:19 +08:00
tycho 92b1d9b2cc fix(runtime-dom): set `text` as an attribute for `a` tags 2024-10-18 17:36:12 +08:00
3 changed files with 14 additions and 1 deletions

View File

@ -311,7 +311,7 @@ function prepareDeps(sub: Subscriber) {
} }
function cleanupDeps(sub: Subscriber) { function cleanupDeps(sub: Subscriber) {
// Cleanup unsued deps // Cleanup unused deps
let head let head
let tail = sub.depsTail let tail = sub.depsTail
let link = tail let link = tail

View File

@ -394,4 +394,12 @@ describe('runtime-dom: props patching', () => {
expect(fn).toBeCalledTimes(0) 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 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 // #8780 the width or height of embedded tags must be set as attribute
if (key === 'width' || key === 'height') { if (key === 'width' || key === 'height') {
const tag = el.tagName const tag = el.tagName