Repository navigation
vapor_split: locate elements by DOM node position (0.16.1) - #7
Merged
Merged
Conversation
Vapor's child and next references count every DOM child node, text runs
and anchors included, but the split's tag mapping counted element
children only. After a text node it looked for the wrong element, found
none, and silently skipped the slot: in
<li>a<ul><li>{{ b }}</li></ul></li> the interpolation disappeared.
Record each tag's node index while scanning the template and resolve
references with it. If an element still can't be located, return an
error instead of dropping its slot or binding.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
For vize 0.16.1.
The bug
vapor_splitsilently dropped slots when a text node came before an element:Vize's IR is correct. It navigates with
child_ref/next_refoffsets that count every DOM child node, including text runs and<!---->anchors, so the innerulis offset 1 inside itsli, after the texta. The split's tag mapping counted element children only, so it found no element at that offset and skipped the slot without an error. A text-only fallback hid the problem in some simpler templates.The fix
child_ref/next_refresolve by it. The element-onlychild_indexis removed.v-modelorv-showbelongs to still can't be located,vapor_splitreturns{:error, [message]}instead of dropping the slot.Found while checking Vue 3.6.0-rc.10's compiler-vapor fixes against Vize. Those fixes are upstream Vize's to port; this bug was in vize_ex's own split code.
This also carries a docs-only commit linking Vue's documentation for Vapor mode, SFCs and SSR.
Verification
VIZE_EX_BUILD=1 mix cipasses: lint (including clippy) and 125 tests.foreignObject, interleaved text andv-foroptions all place every slot and binding.