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

Introduce &:: operator for pseudo-elements. #33

Merged
merged 1 commit into from
May 10, 2023

Conversation

nsaunders
Copy link
Owner

Description

The &: operator, previously overloaded to support both pseudo-elements and pseudo-classes, has been modified to support only pseudo-classes. Pseudo-elements now require the &:: operator instead.

Design considerations

The motivation for this design change is twofold:

  1. According to MDN, "double colons should be used" for pseudo-elements to distinguish from pseudo-classes. In my interpretation, this syntax is considered helpful for understanding the target of a selector, so that the name of the pseudo-selector is not the only way to distinguish whether it is a pseudo-class or a pseudo-element.
  2. The implementation of the &: operator is greatly simplified, e.g. several type classes removed, including some fancy-pants fundep stuff.

Future plans

This might help open the door for providing some "escape hatches" as requested in #28. I would much rather offer unsafePseudoClass and unsafePseudoElement functions, for example, than a single unsafePseudo function, because the type of pseudo-selector is important for determining whether the selector can continue to be extended with additional pseudo-classes etc.

References

Code change checklist

  • Any new or updated functionality includes corresponding unit test coverage.
  • I have verified code formatting, run the unit tests, and checked for any changes in the examples.
  • I have added an entry to the Unreleased section of the CHANGELOG.

@nsaunders nsaunders force-pushed the feature/pseudo-element-double-colon branch from 7ee88d7 to 27fc3fa Compare May 10, 2023 19:00
@nsaunders nsaunders force-pushed the feature/pseudo-element-double-colon branch from 27fc3fa to e3b1fa3 Compare May 10, 2023 19:09
@nsaunders nsaunders merged commit 1097b36 into master May 10, 2023
@nsaunders nsaunders added enhancement New feature or request breaking Non-backward-compatible API change labels May 13, 2023
@nsaunders nsaunders deleted the feature/pseudo-element-double-colon branch July 27, 2023 22:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking Non-backward-compatible API change enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant