calc() causing RBRACE Expected error
Hi,
we use CSSLint at work and I broke the build with code similar to:
.selector {
border : 1px solid #ccc ;
padding : 4px 8px 3px ;
width : 99% ;
width : -moz-calc( 100% - 16px ) ;
width : -webkit-calc( 100% - 16px ) ;
width : calc( 100% - 16px ) ;
}
The error we get is something like, RBRACE Expected at line X....
This has happened when calc() is used for heights and widths. I've noticed that there is no support for calc in CSSLint right now, is there a plan to add it any time soon?
Ah yes, the parser doesn't yet support calc(). It's a bit tricky to add, but it's definitely time to do it.
Ahh cool, thanks! :D
I cloned the repo to see if there was anything in there atm and was going to have a go at adding support myself, then submitting a pull request.
Unfortunately, time constraints for our project mean my time is required elsewhere, shame though, I would have liked to have taken a deep dive in. The code looks hella-sexy btw. ;^)
This should be fixed in v0.9.10.
Are we sure this is fixed? I'm coming across the same error using 0.9.10. Specific case is:
CSS: height: -webkit-calc(100% + 2px); Complaint: 1: error at line 183, col 36, Expected RBRACE at line 183, col 36
I couldn't find any docs on ignoring this line specifically. Would that be possible in the interm?
I just tried it and didn't get an error. It's possible that there is an error somewhere close to that line but not necessarily with the calc().
On Tue, Feb 12, 2013 at 9:07 PM, Erik Johnson [email protected]:
Are we sure this is fixed? I'm coming across the same error using 0.9.10. Specific case is:
CSS: height: -webkit-calc(100% + 2px); Complaint: 1: error at line 183, col 36, Expected RBRACE at line 183, col 36
I couldn't find any docs on ignoring this line specifically. Would that be possible in the interm?
— Reply to this email directly or view it on GitHubhttps://github.com/stubbornella/csslint/issues/267#issuecomment-13474802.
Nicholas C. Zakas @slicknet
Author, Professional JavaScript for Web Developers Buy it at Amazon.com: http://www.amazon.com/Professional-JavaScript-Developers-Nicholas-Zakas/dp/1118026691/ref=sr_1_3
Thanks for the response. Must be incompatibility with my specific node version. I'll try a couple different things.
@nzakas this still causes an error when the expression uses parenthesis itself, like the valid calc((5em - 100%) / -2).
Same for me with this line:
width: calc((100% - 20px) / 3);
I just noticed the same today with http://csslint.net with
width: calc(((100% - 15%) / 3 - 1px) * 3 + 10%);
@nzakas, what's the reason for not applying/re-using the fix from https://github.com/CSSLint/parser-lib/pull/113?