postcss / postcss-selector-parser

A CSS selector parser, integrates with postcss but does not require it.
MIT License
205 stars 49 forks source link

infinite loop when using processSync with some css selectors that has "|" #266

Closed mostafa-hisham closed 1 year ago

mostafa-hisham commented 2 years ago

when using processSync on css rules contains | Leeds to infinite loops some rules examples

.example1,|#example2{
color:red
}

*|:{font-size:10px}

| .example{
color:blue;
}
alexander-akait commented 2 years ago

Sounds like a bug, feel free to send a fix

iskandar-aptiv commented 2 years ago

seems missed to update position when pipe is detected| here https://github.com/postcss/postcss-selector-parser/blob/master/src/parser.js#L518 So far where pipe is checked there is increment. see https://github.com/postcss/postcss-selector-parser/blob/master/src/parser.js#L900

romainmenke commented 1 year ago

What is the expectation here?

All the examples given are invalid selectors, neither column combinators, nor namespaces.


An error seems the best option imo. Using | for custom syntax that has nothing to do with namespaces seems like a bad idea. So incorrect syntax should error as it does in the other cases.