BundlerMinifier icon indicating copy to clipboard operation
BundlerMinifier copied to clipboard

error on css if using ":has"

Open zecompadre opened this issue 2 years ago • 7 comments

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

zecompadre avatar Oct 03 '22 15:10 zecompadre

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; }

failwyn avatar Oct 19 '22 17:10 failwyn

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

mdstevensjr avatar Dec 30 '22 03:12 mdstevensjr

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

failwyn avatar Dec 30 '22 13:12 failwyn

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 avatar Nov 19 '23 22:11 AlfonsoML

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

AlfonsoML avatar Nov 19 '23 22:11 AlfonsoML

@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?

failwyn avatar Jul 18 '24 16:07 failwyn

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 https://github.com/trullock/NUglify/issues/401 for the "@supports selector"

AlfonsoML avatar Jul 20 '24 17:07 AlfonsoML