Coder Social home page Coder Social logo

Comments (2)

denbezrukov avatar denbezrukov commented on September 13, 2024 1

swc has the same problem: https://swc-css.netlify.app/?code=eJzLTczMU6jm4sxJTErNscrIL0stAnE50_LzSnTLUzPTM0qsFEwNDKy5OGu5agFeiw4W

Workaround:

main {
	& label:hover {
		font-weight: 500;
	}
}

The problem is that it's impossible to understand if the next element is a property declaration or a pseudo-class with a type selector. We can try to check the token after : and see if it's a known pseudo-class. Do you think this is a good solution?

from biome.

Sec-ant avatar Sec-ant commented on September 13, 2024 1

Thanks for checking this issue!

swc has the same problem: https://swc-css.netlify.app/?code=eJzLTczMU6jm4sxJTErNscrIL0stAnE50_LzSnTLUzPTM0qsFEwNDKy5OGu5agFeiw4W

I wonder what the "Allow legacy nesting" option means in swc. If I enable it, it seems to parse the selector with pseudo classes correctly. And if I disable it, it won't parse nesting selectors at all, even without a pseudo class: https://swc-css.netlify.app/?code=eJzLTczMU6jm4sxJTErNATE40_LzSnTLUzPTM0qsFEwNDKy5OGu5agH83Au4

The problem is that it's impossible to understand if the next element is a property declaration or a pseudo-class with a type selector. We can try to check the token after : and see if it's a known pseudo-class. Do you think this is a good solution?

I'm not sure about checking for known pseudo classes. I have a very limited knowledge about how our parser works and the CSS spec. But I wonder if it is possible to backtrack when it encounters an opening curly brace { if it erroneously reads it as a property declaration the first pass?

I do think the workaround is good enough for users who encounter this problem!

from biome.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.