Subscribe on changes!

Empty text nodes before and after list rendering

avatar
Jun 6th 2022

Vue version

3.2.36

Link to minimal reproduction

https://sfc.vuejs.org/#eyJBcHAudnVlIjoiPHNjcmlwdCBzZXR1cD5cbiAgaW1wb3J0IHsgcmVmLCBvbk1vdW50ZWR9IGZyb20gJ3Z1ZSdcbiAgbGV0IHJvb3QgPSByZWYoKTtcbiAgb25Nb3VudGVkKCgpID0+IHtcbiAgICBjb25zb2xlLmxvZygnY2hpbGQgbm9kZXMnLCByb290LnZhbHVlLmNoaWxkTm9kZXMpO1xuICB9KVxuPC9zY3JpcHQ+XG5cbjx0ZW1wbGF0ZT5cblx0PHVsIHJlZj1cInJvb3RcIj5cbiAgICA8bGkgdi1mb3I9XCJuIG9mIDNcIj57e259fTwvbGk+XG4gIDwvdWw+XG48L3RlbXBsYXRlPiIsImltcG9ydC1tYXAuanNvbiI6IntcbiAgXCJpbXBvcnRzXCI6IHtcbiAgICBcInZ1ZVwiOiBcImh0dHBzOi8vc2ZjLnZ1ZWpzLm9yZy92dWUucnVudGltZS5lc20tYnJvd3Nlci5qc1wiXG4gIH1cbn0ifQ==

Steps to reproduce

After opening the link, checkout the console

What is expected?

List rendering should not render two empty text nodes before and after the list.

What is actually happening?

Vue3 list rendering renders two empty text nodes before and after the list, like this:

NodeList(5) [ #text, li, li, li, #text ]

React and vue2 does not have them.

System Info

No response

Any additional comments?

The empty text nodes cause compat problems inside contenteditable. I hope they could be removed.

avatar
Jun 6th 2022

They are necessary to serve as anchors of fragments - unfortunately it's not possible to remove them.

avatar
Jun 6th 2022

Can comment node be used for this purpose?