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

error on css if using ":has" #12

Open
zecompadre opened this issue Oct 3, 2022 · 7 comments
Open

error on css if using ":has" #12

zecompadre opened this issue Oct 3, 2022 · 7 comments

Comments

@zecompadre
Copy link

Installed product versions

  • Visual Studio: 2022 Professional
  • This extension: 2.9.3

Description

Severity Code Description Project File Line Suppression State
Error 0 Expected identifier, found ':' ...\wwwroot\Themes\Main.css

Steps to recreate

.form-property-check-item .drop-value:not(:has(input:checked)) + .property .property-list-title,

Current behavior

if i have :has(xxxxx) gives the error

Expected behavior

if i remove :has(xxxxx) its ok

@failwyn
Copy link
Owner

failwyn commented Oct 19, 2022

Can you provide a small sample application that I can use to debug your issue? I've tried multiple combinations of :has and they all compile as expected.

.l-test:has(.l-te) {
cursor: pointer;
}

.l-test:not(:has(.l-te)) {
cursor: pointer;
}

.form-property-check-item .drop-value:not(:has(input:checked)) + .property .property-list-title {
cursor: pointer;
}

@mdstevensjr
Copy link

@failwyn I believe the issue is in the BuildBundlerMinifier nuget package. If I uninstall, the extension compiles the :has pseudo-class without error.

@failwyn
Copy link
Owner

failwyn commented Dec 30, 2022

Thanks, I’ll test using the nuget package when I get back to work next week.

@AlfonsoML
Copy link

For me it fails if the has selector includes an id fragment, but not with a class.
This fails

.MaquetacionColumnas:has(#VentaRapida) {
	position: relative;
}

This works OK

.MaquetacionColumnas:has(.VentaRapida) {
	position: relative;
}

Visual Studio 17.8.0
Bundler & Minifier 2.9.9

@AlfonsoML
Copy link

AlfonsoML commented Nov 19, 2023

I think that it should also be noted here that support for the :has selector fails:

@supports selector(:has(*)) {
	.VentaRapida {
		position: absolute;
	}
}

Gives an error due to the @supports block

@failwyn
Copy link
Owner

failwyn commented Jul 18, 2024

@AlfonsoML would you mind adding an issue to the NUglify Repo about the :has selector with the Id and create a new issue for @support?

@AlfonsoML
Copy link

The :has() with an id it's working properly for me in current master of NUglify:

var result = Uglify.Css(@".MaquetacionColumnas:has(#VentaRapida) {
	position: relative;
}");

.MaquetacionColumnas:has(#VentaRapida){position:relative;}

but it's still generating the same error in Bundler&Minifier:
(Bundler & Minifier) Expected identifier, found '#VentaRapida'

I've created trullock/NUglify#401 for the "@supports selector"

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

No branches or pull requests

4 participants