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

Add support for * prefix in declaration names #388

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

hamidrezakp
Copy link

Hey
This is a hacky fix for adding support of legacy * prefixes to cssparser.

Currently this fails to be parsed:

p {
    *color: red;
}

And there is a good reason to it, This legacy syntax is only used for ie 6/7 and it's not valid css3 grammar too.

But some libraries and old codebases still depend on this kind of properties to work on old browsers.

I know this is not a correct way to do it, but if you have plans to add this feature to parser, i can prepare another fix that uses feature-gates in cargo.toml and has proper parsing methods for handling this kind of syntax.

Copy link
Member

@emilio emilio left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At the very least this would need tests, but not opposed to this in principle if it's not too annoying...

@@ -211,6 +211,10 @@ where
hex_escape(digit, dest)?;
value = &value[1..];
}
if b'*' == value.as_bytes()[0] {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not correct, this is not an identifier.

@hamidrezakp
Copy link
Author

Yes, this needs a redo with correct method and comprehensive tests.

I can do the changes if you are interested in having this feature.

@emilio
Copy link
Member

emilio commented Nov 10, 2024

I don't think we're particularly interested in it, if some tooling needs it we could accept it I guess but...

That said, I wonder if this could be implemented on top of cssparser too without changes (basically, on the error code path, try to consume the asterisk + ident + colon)

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

Successfully merging this pull request may close these issues.

2 participants