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

Simplify the hover replacement function #1535

Merged
merged 2 commits into from
Sep 13, 2024

Conversation

eoghanmurray
Copy link
Contributor

See #1458 and https://github.com/giuseppeg/postcss-pseudo-classes/blob/master/index.js for the full version; we didn't need all the features so we added if (pseudoToCheck !== ':hover') { but this PR goes further to reduce code.

Copy link

changeset-bot bot commented Jul 16, 2024

🦋 Changeset detected

Latest commit: 21407df

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 19 packages
Name Type
rrweb-snapshot Patch
rrweb Patch
rrdom Patch
rrdom-nodejs Patch
rrweb-player Patch
@rrweb/all Patch
@rrweb/replay Patch
@rrweb/record Patch
@rrweb/types Patch
@rrweb/packer Patch
@rrweb/utils Patch
@rrweb/web-extension Patch
rrvideo Patch
@rrweb/rrweb-plugin-console-record Patch
@rrweb/rrweb-plugin-console-replay Patch
@rrweb/rrweb-plugin-sequential-id-record Patch
@rrweb/rrweb-plugin-sequential-id-replay Patch
@rrweb/rrweb-plugin-canvas-webrtc-record Patch
@rrweb/rrweb-plugin-canvas-webrtc-replay Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@eoghanmurray
Copy link
Contributor Author

This PR has resulted in a test change which wasn't anticipated, however instead of reverting I believe updating the tests is actually the correct path!

We added the test in question in #1440 and it looks like the following:

body > ul :is(li:not(:first-of-type) a:hover, li:not(:first-of-type).active a) {background: red;}

The focus then was on ensuring that the above wasn't parsed as two separate selectors because of the internal comma (which is actually a comma of the :is expression). I think we missed that there was also a :hover in there which should mean that the whole selector should be duplicated. I've added a new test doesn't ignore :hover within :is brackets to formalize this expectation.

With the pseudoClassPlugin postcss plugin, and also in the version prior to that, everything between the brackets of :is was bundled with the :is, so the internal :hover was being ignored.

…PR, however I don't think that the previous behaviour was desirable, so have added a new test to formalize this expectation
@eoghanmurray eoghanmurray merged commit 04ee6ed into rrweb-io:master Sep 13, 2024
6 checks passed
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