Skip to content

fix: support html 0.15.7 by matching selectors via SelectorEvaluator - #1517

Open
heitor598 wants to merge 1 commit into
Sub6Resources:masterfrom
heitor598:fix/html-0-15-7-matches
Open

heitor598 wants to merge 1 commit into
Sub6Resources:masterfrom
heitor598:fix/html-0-15-7-matches

Conversation

@heitor598

Copy link
Copy Markdown

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.

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

3 participants