-
Notifications
You must be signed in to change notification settings - Fork 49
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
Error in function argument parsing #90
Comments
Changing the grammar to treat the (optional) MINUS token as part of the number, dimension, etc., works for this use case, but breaks Perhaps it would be best to do some post-processing that merges the MINUS operator with subsequent terms? |
I mean the parsing works fine, the problem is in output formatting. Unfortunately, the functions may have very different kinds of arguments (lengths, identifiers, comma-separated lists, space-separated lists, etc.) and therefore, the operators are treated separately from the values (e.g. lengths). For the same reason, it is not easy to find a unified way of formatting the arguments for output. My proposed solution for this particular issue is in this commit. But perhaps the real solution would be to treat each function individually (as |
You're right, there are multiple places this could be fixed. But I would argue that Going through the list of functions at MDN, only And while full validation for each function is a nice goal, the list is extensive, and new functions seem to be added fairly frequently, so treating each separately will involve a lot of work. |
This commit implements the merging that I mentioned earlier. What do you think? |
Yes, this seems like a good direction. I have made some comments to the commit itself. My idea was to go even one step further: Not to create just a universal |
That sounds like a very good long-term solution. Do you want to merge my changes as a short-term fix, or just start on the long-term framework? |
I made a PR for my changes, in case you want to use them. |
* Test for issue #90 * Merge minus operators with subsequent terms This happens for all non-calc and non-url functions.
I tried to create a list of all functions mentioned on MDN grouped by categories: css_functions.txt. There are many of them. The plan is to support the most common ones (such as |
Sorry for jumping in without reading up fully, but I tried the latest master branch of jstyleParser with gngr, and there's only one regression. Not sure if it's relevant to this issue. The test case uses a counter as follows:
It used to work earlier (in the 3.2 series). Note that simple pseudo elements still work, hence I am suspecting a problem in the counter function area. |
Yes, it is related, thanks for reporting this. There was a bug in |
After parsing, the function
translateY(-.1em)
is output astranslatey(- .1em)
. There should not be a space between the minus sign and the length.The text was updated successfully, but these errors were encountered: