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

Using :is(a, b) selector in style tag breaks #2967

Closed
1 of 7 tasks
webgoto opened this issue Oct 5, 2022 · 11 comments
Closed
1 of 7 tasks

Using :is(a, b) selector in style tag breaks #2967

webgoto opened this issue Oct 5, 2022 · 11 comments
Assignees

Comments

@webgoto
Copy link

webgoto commented Oct 5, 2022

Help us to manage our issues by answering the following:

  1. Describe your issue:

My css
p :is(a, span){color: red;}

is output like this
my-tag p :is(a,[is="my-tag"] p :is(a,my-tag span),[is="my-tag"] span){color: red;}

Content that should be output
my-tag p :is(a, span),[is="my-tag"] p :is(a, span){color: red;}

I think the selector is split due to the inclusion of ","
I think it also happens with :not(), :where(), etc.

  1. Can you reproduce the issue?
    https://plnkr.co/edit/869A7mlEqgTxHJxA?preview

  2. On which browser/OS does the issue appear?
    windows10
    Chromium: 105.0.5195.102

  3. Which version of Riot does it affect?
    riot 7.0.6
    riot 3.13.2
    Please also fix v3

  4. How would you tag this issue?

  • Question
  • Bug
  • Discussion
  • Feature request
  • Tip
  • Enhancement
  • Performance
@webgoto
Copy link
Author

webgoto commented Oct 28, 2022

Thank you for your quick fix.

I looked at the current fix and there might be a problem

I believe that if you use "is()" multiple times, it will only reflect on the right side.

For example using this selector
.foo :is(.bar,.baz) :is(.d, .e)

Isn't the output like this?
my-tag .foo :is(.bar,.baz),[data-is="my-tag"] .foo :is(.bar,.baz) :is(.d, .e)

I apologize if I'm wrong.

GianlucaGuarini added a commit to riot/compiler that referenced this issue Oct 29, 2022
@GianlucaGuarini
Copy link
Member

@webgoto no the patch works with your example as well. I have added a test for it just in case. Thank you for your feedback

@webgoto
Copy link
Author

webgoto commented Oct 30, 2022

Thank you for confirming

@webgoto
Copy link
Author

webgoto commented Oct 31, 2022

sorry. An incorrect example is used for testing.

For example using this selector
.foo :is(.bar,.baz) :is(.d, .e)

buggy output(used for testing)
my-tag .foo :is(.bar,.baz),[is="my-tag"] .foo :is(.bar,.baz) :is(.d, .e)

correct output
my-tag .foo :is(.bar,.baz) :is(.d, .e),[is="my-tag"] .foo :is(.bar,.baz) :is(.d, .e)

@GianlucaGuarini
Copy link
Member

Thank you for your feedback I think now it should work fine.

@GianlucaGuarini
Copy link
Member

This has been fixed in riot@7.0.7

@webgoto
Copy link
Author

webgoto commented Nov 2, 2022

I'm sorry many times.
I think there is a bug when writing a normal selector after ":is".
(v7.0.7)

example

span :is(p, b) a {}

@GianlucaGuarini
Copy link
Member

Thank you I will have a look at it

@exside
Copy link

exside commented Nov 2, 2022

I think this broke my app, potential reason: because i'm using escaped colons (:) e.g. \: for my utility classes, like this:

		.scale\:frame > * {
			/* 4 */
			margin: auto;
			position: absolute;
			top: 0;
			right: 0;
			bottom: 0;
			left: 0;
		}

		.scale\:img {
			/* 5 */
			display: block;
			height: auto;
			max-width: 100%;
		}

possible? will quickly revert to last version of riot and confirm. It might be an edge case (don't know how many other devs write CSS classes like this, but it's valid CSS and shouldn't break imho)

the suspicion that something changed in riot came up bc my production builds are fine, but there i'm using a local copy of riot (e.g. not the newest one) while for my dev environment i'm using latest.

EDIT: Confirmed, switching back to 7.0.6 fixes the issue.

@GianlucaGuarini
Copy link
Member

Fixed in riot@7.1.0 thank you for submitting this issue

@exside
Copy link

exside commented Nov 10, 2022

Thank you for fixing it, works again, awesome!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants