Skip to content

Fix incorrect grouping when identical text nodes occur#36

Open
nquenouille wants to merge 2 commits into
dariok:masterfrom
nquenouille:pullrequest260506
Open

Fix incorrect grouping when identical text nodes occur#36
nquenouille wants to merge 2 commits into
dariok:masterfrom
nquenouille:pullrequest260506

Conversation

@nquenouille
Copy link
Copy Markdown

Problem: When processing continued elements, tag spans could extend too far if identical text content appeared multiple times (e.g. repeated words).

Cause: The code used index-of(current-group(), $final) to determine the position of a node within a group.
However, index-of() compares atomic values, not node identity.
As a result, multiple nodes with identical string values were treated as equal, and the last matching position was selected.

Solution: Replaced the index-of()-based lookup with a node identity comparison using "is", ensuring that the correct node instance is selected even when text content is identical.

Result:

  • Correct closing of tag spans
  • No unintended merging across identical text nodes
  • Stable behavior regardless of duplicate string values

This change avoids value-based comparison for node sequences and ensures consistent behavior when duplicate text nodes are present.

With many thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant