fix: cleanup

This commit is contained in:
Nolan Lawson 2024-03-16 09:53:57 -07:00
parent 8079a774b0
commit 5c979fb2d3
1 changed files with 4 additions and 2 deletions

View File

@ -200,7 +200,9 @@ function parse (tokens) {
}
if (!withinTag && !withinAttribute) {
// add the index as a text node, so we can find it later
// Add the index as a text node, so we can find it later.
// Using a text node rather than a comment node means this can be a simple `node.nodeValue` update rather than
// replacing the whole node when we need to patch later.
htmlString += bindings.length
}
@ -218,7 +220,7 @@ function parse (tokens) {
function findPlaceholderTextNode (element, bindingId) {
// This can technically conflict with user markup, but we just don't support numeric literals in tags, e.g.
// `<div>123</div>`
const bindingIdAsNodeValue = '' + bindingId
const bindingIdAsNodeValue = toString(bindingId)
// If we had a lot of placeholder nodes to find, it would make more sense to build up a map once
// rather than search the DOM every time. But it turns out that we always only have one child,
// and it's the placeholder node, so searching every time is actually faster.