Repository navigation
fix: support html 0.15.7 by matching selectors via SelectorEvaluator - #1516
Open
Mastermegamind wants to merge 1 commit into
Open
Mastermegamind wants to merge 1 commit into
Mastermegamind wants to merge 1 commit into
Conversation
html 0.15.7 removed the top-level `matches(Element, String)` from
`lib/src/query_selector.dart`, keeping only `SelectorEvaluator.matches`.
`StyledElement.matches` called the removed function, so flutter_html no
longer compiles against html 0.15.7:
Error: Method not found: 'matches'.
package:html/src/query_selector.dart
The declared constraint is `html: ^0.15.5`, so pub resolves 0.15.7 by
default and any downstream project picks up the break on its next
`pub upgrade`. The only workaround available today is a dependency
override pinning html to 0.15.6.
This parses the selector with csslib — already a direct dependency — and
matches with `SelectorEvaluator`, which is present and unchanged across
html 0.15.x. That makes it work on either side of the removal, so it needs
no constraint bump.
This is the TODO immediately above the import coming true; the
implementation import stays, since SelectorEvaluator is only reachable
through it.
Verified against the package's own suite:
html 0.15.6, before this change: 232 passed, 1 failed
html 0.15.7, before this change: 13 passed, 11 failed
html 0.15.6, after this change: 232 passed, 1 failed
html 0.15.7, after this change: 232 passed, 1 failed
The single remaining failure (whitespace_test.dart, details/summary
newlines) is pre-existing on master and unrelated.
heitor598
approved these changes
Aug 31, 2026
3 tasks done
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.
The problem
html0.15.7 removed the top-levelmatches(Element, String)fromlib/src/query_selector.dart, keeping only theSelectorEvaluator.matchesmethod.StyledElement.matchescalls the removed function, so flutter_html no longer compiles against html 0.15.7:The declared constraint is
html: ^0.15.5, so pub resolves 0.15.7 by default. Downstream projects pick this up on their nextpub upgradewith no constraint violation to warn them, and the only workaround available today is adependency_overridesentry pinning html back to 0.15.6.This is the
TODOimmediately above that import coming true.The change
Parse the selector with
csslib— already a direct dependency of this package — and match withSelectorEvaluator, which is present and unchanged across html 0.15.x.Because
SelectorEvaluator.matchesexists in both 0.15.6 and 0.15.7, this works on either side of the removal and needs no constraint bump.The
implementation_importsignore and its TODO stay as they are:SelectorEvaluatoris only reachable through that path, so this narrows the exposure to the private API rather than eliminating it.Verification
Ran this package's own test suite against both html versions, before and after:
The patch restores 0.15.7 to exact parity with the 0.15.6 baseline.
The single remaining failure —
whitespace_test.dart, "extra newlines aren't added unnecessarily for details/summary tags" — is pre-existing on master and unrelated to this change; it fails identically on unpatched master with html 0.15.6.