Skip to content

Extend text ranges when merging CDATA fragments - #156

Open
mikamikasuki wants to merge 1 commit into
RazrFalcon:masterfrom
mikamikasuki:fix/merged-text-range
Open

mikamikasuki wants to merge 1 commit into
RazrFalcon:masterfrom
mikamikasuki:fix/merged-text-range

Conversation

@mikamikasuki

Copy link
Copy Markdown

When adjacent text and CDATA fragments are merged, Node::range() currently ends at the first fragment. Extend the end position as further document fragments are appended. Ignore offsets from entity expansions, which can refer to the DTD or external input.

Regression coverage includes both text/CDATA orders, consecutive and empty CDATA, CRLF normalization, Unicode, character references, node boundaries, and preservation of external entity offsets.

Fixes #112.

Validation: all 300 unit/integration tests and 32 doctests pass with default features; all 291 tests and 32 doctests pass without positions. Builds without std pass with and without positions. The 26 API tests also pass under Rust 1.60 using compatible memchr 2.5.0. Tested on arm64 macOS.

Prepared with AI assistance.

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.

Text node end position is broken when CDATA is present

1 participant