-
Notifications
You must be signed in to change notification settings - Fork 101
Added fix for handling of spaces within parenthesis in values. #87
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
Conversation
…dded handling of nested parenthesis in a value so that it doesn't leave the value parenthesis state until all open parenthesis are matched with a close. Added a test for the case I ran across this problem where I had a linear-gradient with an RGBA value for the second transition point, but transparent for the first. The space was dropped after the transparent, but not the rgba value because the closing paren of the RGBA value transitioned back into the value state from value-parenthesis.
NV
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for your patch!
Please fix coding style issues and it's good to be merged.
lib/parse.js
Outdated
|
|
||
| var index; | ||
| var buffer = ""; | ||
| var valueParenthesisDepth=0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Spaces around =.
lib/parse.js
Outdated
| // ie css expression mode | ||
| if (buffer.trim() === 'expression') { | ||
| var info = (new CSSOM.CSSValueExpression(token, i)).parse(); | ||
| var info = (new CSSOM.CSSValueExpression(token, i)).parse(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use tabs for indentation.
lib/parse.js
Outdated
| if (state === 'value-parenthesis') { | ||
| state = 'value'; | ||
| valueParenthesisDepth--; | ||
| if(valueParenthesisDepth === 0) state = 'value'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Space after if.
|
Ok - made the requested changes. Thanks! |
|
whoops -just realized I made the changes in the wrong branch. Will have those submitted in just a minute. |
…- the else if check that increased the valueParenthsisDepth was part of the wrong if block.
|
Ok - I've got that up now. I also fixed a bug in my original PR - the else if block that incremented the valueParenthesisDepth was in the wrong if - it was inside the block for state === 'value'. Let me know if you want me to squash these commits. |
Also added handling of nested parenthesis in a value so that it doesn't leave the value-parenthesis state until all open parenthesis are matched with a close.
Added a test for the case I ran across this problem where I had a linear-gradient with an RGBA value for the second transition point, but transparent for the first. The space was dropped after the transparent, but not the rgba value because the closing paren of the RGBA value transitioned back into the value state from value-parenthesis.
This should resolve #86 also - I just added a test case for that to my PR.