Skip to content

Fix not() keeping SplObjectStorage nodes instead of removing them - #106

Merged
jakejackson1 merged 1 commit into
mainfrom
fix/issue-75
Oct 26, 2026
Merged

jakejackson1 merged 1 commit into
mainfrom
fix/issue-75

Conversation

@gravitypdf-bot

Copy link
Copy Markdown
Contributor

not() given an SplObjectStorage kept only the nodes in the storage, because its branch was missing the negation the array and DOMElement branches have.

$all     = qp($xml, "a, b, c");
$exclude = $all->branch()->top()->find("a");

$all->not($exclude->get());           // b, c
$all->not($exclude->get(null, true)); // before: a   after: b, c

Change: negate the offsetExists() check in QueryFilters::not().

Tests: DOMQueryTest::testNotRemovesTheSameNodesForEveryArgumentType checks that a selector, an array, an SplObjectStorage and a DOMElement drawn from the same document (via branch()) all remove the same nodes. The SplObjectStorage assertion fails without the fix.

Behaviour change: code passing an SplObjectStorage to not() and relying on the old intersection result will now get the complement.

Fixes #75.

🤖 Generated with Claude Code

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 90.78%. Comparing base (6ae6acf) to head (c576b73).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff              @@
##               main     #106      +/-   ##
============================================
+ Coverage     90.69%   90.78%   +0.09%     
  Complexity     1424     1424              
============================================
  Files            25       25              
  Lines          3170     3170              
============================================
+ Hits           2875     2878       +3     
+ Misses          295      292       -3     

☔ 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.

@jakejackson1 jakejackson1 added the bug Something isn't working label Oct 26, 2026
@jakejackson1
jakejackson1 merged commit 95dbf53 into main Oct 26, 2026
14 checks passed
@jakejackson1
jakejackson1 deleted the fix/issue-75 branch October 26, 2026 00:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

not() keeps the excluded nodes instead of removing them when given an SplObjectStorage

2 participants