Skip to content

Cache element last child during HTML append - #121

Merged
kitsuyui merged 1 commit into
mainfrom
fix/text-coalesce-linear-scan
Jul 3, 2026
Merged

Cache element last child during HTML append#121
kitsuyui merged 1 commit into
mainfrom
fix/text-coalesce-linear-scan

Conversation

@kitsuyui

Copy link
Copy Markdown
Owner

Summary

  • Update src/lib.rs to cache each element's last child inside DocHtmlSink so text coalescing does not rescan all children on every append.
  • Update or invalidate the cache when append, remove, append-before-sibling, and reparent operations can change an element's last child.
  • Add a src/lib.rs flat sibling regression test that parses hundreds of span and trailing text sibling pairs.

Verification

  • cargo fmt --all -- --check
  • cargo clippy --all-targets --all-features -- -D warnings
  • cargo check
  • cargo test --all-targets --all-features
  • cargo test --all-features
  • cargo build --release --all-features
  • scripts/test-check-cargo-version-tag.sh

Not run locally:

  • cargo llvm-cov --lcov --output-path coverage.lcov (coverage reporting is left to CI)
  • reusable spellcheck workflow (no documentation files changed)

@github-actions

Copy link
Copy Markdown

Code Metrics Report

main (928e2f2) #121 (e670b1b) +/-
Coverage 68.3% 69.0% +0.7%
Code to Test Ratio 1:0.1 1:0.1 -0.1
Test Execution Time 5s 11s +6s
Details
  |                     | main (928e2f2) | #121 (e670b1b) |  +/-  |
  |---------------------|----------------|----------------|-------|
+ | Coverage            |          68.3% |          69.0% | +0.7% |
  |   Files             |              4 |              4 |     0 |
  |   Lines             |            550 |            605 |   +55 |
+ |   Covered           |            376 |            418 |   +42 |
- | Code to Test Ratio  |          1:0.1 |          1:0.1 |  -0.1 |
  |   Code              |            593 |            652 |   +59 |
  |   Test              |             71 |             71 |     0 |
- | Test Execution Time |             5s |            11s |   +6s |

Code coverage of files in pull request scope (68.8% → 69.5%)

Files Coverage +/- Status
src/handle.rs 17.4% +6.3% affected
src/lib.rs 76.2% -0.9% modified

Reported by octocov

@kitsuyui
kitsuyui merged commit eed4cfd into main Jul 3, 2026
6 checks passed
@kitsuyui
kitsuyui deleted the fix/text-coalesce-linear-scan branch July 3, 2026 17:55
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