Skip to content

Copy replaceAll() replacements with their children - #156

Open
gravitypdf-bot wants to merge 3 commits into
mainfrom
fix/issue-135
Open

gravitypdf-bot wants to merge 3 commits into
mainfrom
fix/issue-135

Conversation

@gravitypdf-bot

Copy link
Copy Markdown
Contributor

Fixes #135.

replaceAll() copied each replacement with a shallow cloneNode() and then a shallow importNode(), so it inserted empty copies. It now copies the whole subtree with importNode($replacement, true).

Tests

tests/Issues/Issue135Test.php checks that each inserted copy keeps its attributes, text and children, is a separate node, and leaves the source document untouched.

Every PR in this set adds its CHANGELOG line at the end of # Unreleased changes, so each one after the first needs a one-line conflict resolved there.

🤖 Generated with Claude Code

gravitypdf-bot and others added 3 commits October 26, 2026 17:18
replaceAll() made a shallow clone of the replacement and a shallow import of
that, so each replaced node arrived with its attributes but no children.
Import the replacement deeply instead.

Fixes #135

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@codecov

codecov Bot commented Oct 26, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 91.23%. Comparing base (6ae6acf) to head (0d24b17).
⚠️ Report is 19 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff              @@
##               main     #156      +/-   ##
============================================
+ Coverage     90.69%   91.23%   +0.53%     
- Complexity     1424     1441      +17     
============================================
  Files            25       26       +1     
  Lines          3170     3182      +12     
============================================
+ Hits           2875     2903      +28     
+ Misses          295      279      -16     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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.

replaceAll() inserts empty copies: it clones the replacement without its children

1 participant