Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve pseudo-class error message #270

Merged
merged 2 commits into from
Jul 10, 2024
Merged

Improve pseudo-class error message #270

merged 2 commits into from
Jul 10, 2024

Conversation

facelessuser
Copy link
Owner

When encountering a pseudo-class that is unrecognized, we should not state it is "unsupported" a it may be entirely invalid. While there are some pseudo-classes that are valid but not supported, the status of such things can change all the time and our internal list may become outdated.

Additionally, sometimes users trying to incorrectly specify tags with namespaces can trigger this message as they may assume that because a namespace is declared in their document as ns:element that they can do this in CSS as well. This specific case is not easily detectable for us as we generically parse the syntax, not the intent of the syntax.

To clear up confusion, be more specific and simply state that anytime a pseudo-class is not recognized by soupsieve that it is either invalid or not recognizable by soupsieve. By stating both possibilities, this points out that pseudo-class syntax was noted and that it is unrecognized by soupsieve, regardless of status, and may be entirely invalid. Additionally, note that if it being recognized as a pseudo-class is a surprise that the colon can be escaped to avoid the recognition as such.

When encountering a pseudo-class that is unrecognized, we should not
state it is "unsupported" a it may be entirely invalid. While there are
some pseudo-classes that are valid but not supported, the status of such
things can change all the time and our internal list may become
outdated.

Additionally, sometimes users trying to incorrectly specify tags
with namespaces can trigger this message as they may assume that because
a namespace is declared in their document as `ns:element` that they can
do this in CSS as well. This specific case is not easily detectable for
us as we generically parse the syntax, not the intent of the syntax.

To clear up confusion, be more specific and simply state that anytime
a pseudo-class is not recognized by soupsieve that it is either invalid
or not recognizable by soupsieve. By stating both possibilities, this
points out that pseudo-class syntax was noted and that it is
unrecognized by soupsieve, regardless of status, and may be entirely
invalid. Additionally, note that if it being recognized as a
pseudo-class is a surprise that the colon can be escaped to avoid
the recognition as such.
@gir-bot gir-bot added S: needs-review Needs to be reviewed and/or approved. C: css-parsing Related to CSS parsing. C: docs Related to documentation. C: source Related to source code. labels Jul 10, 2024
@gir-bot gir-bot added C: css-level-1 CSS level 1 selectors. C: tests Related to testing. labels Jul 10, 2024
@facelessuser
Copy link
Owner Author

@gir-bot lgtm

@gir-bot gir-bot added S: approved The pull request is ready to be merged. and removed S: needs-review Needs to be reviewed and/or approved. labels Jul 10, 2024
@facelessuser facelessuser merged commit e0d4979 into main Jul 10, 2024
19 checks passed
@facelessuser facelessuser deleted the bugfix/message branch July 10, 2024 13:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C: css-level-1 CSS level 1 selectors. C: css-parsing Related to CSS parsing. C: docs Related to documentation. C: source Related to source code. C: tests Related to testing. S: approved The pull request is ready to be merged.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants