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

Janky at-rule catches FillDeclaration in an infinite loop #136

Open
phil-scott-78 opened this issue Apr 5, 2022 · 3 comments
Open

Janky at-rule catches FillDeclaration in an infinite loop #136

phil-scott-78 opened this issue Apr 5, 2022 · 3 comments

Comments

@phil-scott-78
Copy link

I pointed this at a tailwind css file with a @apply rule and the ParseStylesheet gets caught in an infinite loop in StylesheetComposer at FillDeclarations trying to handle the AtKeyword.

Quick little reproduction.

var parser = new StylesheetParser();
var r = parser.Parse(@"
.test {
    @apply ml-2;
}
");

As an aside, it would be pretty slick if things like this weren't ignored but included in the results.

@TylerBrinks
Copy link
Owner

Thanks for posting this. While the engine shouldn't land in an endless loop, I'm not sure what to do with the rule since it's not part of the CSS2/3 standard. The @apply tag proposal was abandoned in favor of shadow parts. However some CSS pre-processors make use of it.

The rules currently supported are those listed in the At-rule specs https://developer.mozilla.org/en-US/docs/Web/CSS/At-rule

So the question is whether a malformed rule is something to code for. While this is fine for Tailwind, I don't know if it makes sense to try to add specific At rules as children of properties. Perhaps a generic catch-all rule would suffice - I'll have to think through this one.

@phil-scott-78
Copy link
Author

Yeah, I agree that not a ton of effort should be spent on non-standard things like this. It being discarded wouldn't be an unexpected behavior to me

@colindcli
Copy link

similar bugs
#138

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

3 participants