Repository navigation
Merge css() declarations into each element's own style - #107
Merged
Merged
Conversation
css() read the style attribute of every match into one map and wrote the union back to all of them, so elements picked up each other's declarations. Parse, merge and write per element instead. Fixes #77. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #107 +/- ##
============================================
+ Coverage 90.69% 90.78% +0.08%
Complexity 1424 1424
============================================
Files 25 25
Lines 3170 3168 -2
============================================
+ Hits 2875 2876 +1
+ Misses 295 292 -3 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
css()read thestyleattribute of every matched element into one map, merged the new declarations into it, and wrote that one string back to all of them, so each element picked up the others' declarations.Change:
QueryMutators::css()now does the parse, merge and write separately for each element. Non-element matches are still skipped (#98), and the getter is unchanged.Tests:
DOMQueryTest::testCssMergesIntoEachElementsOwnStylesets styles with both the string and the array form on elements whose existing styles differ, including one with nostyleattribute, and checks that the getter still returns the first element's raw style. The test fails without the fix. phpunit,lintandlint:min-phpall pass.Fixes #77.
🤖 Generated with Claude Code