When CSS is like this
@import url(http://fonts.googleapis.com/css?family=Open+Sans:400,600,300); @charset "UTF-8"; div#abc {~~~~~~~~~~} div#def {~~~~~~~~~~}
It gives a error.
null [2:1] Error in rule. (Invalid token "@charset". Was expecting one of: <S>, <IDENT>, "", ".", ":", "*", "[", <HASH>, <IMPORT_SYM>, <PAGE_SYM>, <MEDIA_SYM>, <FONT_FACE_SYM>, <ATKEYWORD>.)
null [2:1] Ignoring the whole rule.
And CSS Parser can parse from second css. If CSS is above example, CSS Parser can parse from 'div#def'. 'div#abc' is ignored.
But when order changed like this
@charset "UTF-8"; @import url(http://fonts.googleapis.com/css?family=Open+Sans:400,600,300); div#abc {~~~~~~~~~~} div#def {~~~~~~~~~~}
It doesn't give error!
Please fix this bug as soon as possible.
Thanks.
Anonymous
I think you are wrong here. The charset rule has to be the first stuff inside the file.
See https://developer.mozilla.org/de/docs/Web/CSS/@charset for more.
However i have done some improvments on error processing. No the parser restarts always with the first rule after the misplaced charset rule.
Hope that helps - a new snapshot build is available.
View and moderate all "bugs Discussion" comments posted by this user
Mark all as spam, and block user from posting to "Bugs"
I'm using maven. In maven, 0.9.21 version is missing. How can I get cssparser-0.9.21.jar?
Chance the Version in pom.xml to 0.9.22-SNAPSHOT
Last edit: RBRi 2016-11-27
View and moderate all "bugs Discussion" comments posted by this user
Mark all as spam, and block user from posting to "Bugs"
I used cssparser dependency like this. this works.
<dependency>
<groupId>net.sourceforge.cssparser</groupId>
<artifactId>cssparser</artifactId>
<version>0.9.20</version>
</dependency>
But like this, it makes error.
error message is 'Missing artifact net.sourceforge.cssparser:cssparser:jar:0.9.22-SNAPSHOT'
<dependency>
<groupId>net.sourceforge.cssparser</groupId>
<artifactId>cssparser</artifactId>
<version>0.9.22-SNAPSHOT</version>
</dependency>
Is it wrong? Please check my dependency.
Sorry my fault. 0.9.21-SNAPSHOT
Last edit: RBRi 2016-11-27
Is it working now?
View and moderate all "bugs Discussion" comments posted by this user
Mark all as spam, and block user from posting to "Bugs"
0.9.21-SNAPSHOT version makes 'Missing artifact net.sourceforge.cssparser:cssparser:jar:0.9.21-SNAPSHOT' error, too...
Last edit: Anonymous 2016-11-28
View and moderate all "bugs Discussion" comments posted by this user
Mark all as spam, and block user from posting to "Bugs"
0.9.21-SNAPSHOT version makes 'Missing artifact net.sourceforge.cssparser:cssparser:jar:0.9.21-SNAPSHOT' error, too...
There is some documentation about getting the latest snapshot.
http://htmlunit.sourceforge.net/gettingLatestCode.html
View and moderate all "bugs Discussion" comments posted by this user
Mark all as spam, and block user from posting to "Bugs"
I applied snapshot version. But css right after misplaced charset rule is still ignored.
when my css is like this.
and CSSParser gives like this
'div#abc' rule is ignored. How can I handle this?
Strange, that is exactly what i have fixed. Have a look at SACParserCSS3Test.charsetImportBefore(). Can you please provide a small code sample.
View and moderate all "bugs Discussion" comments posted by this user
Mark all as spam, and block user from posting to "Bugs"
This is a sample code.
OK, you found another issues - the problem is in the skip code that is not able to deal with the comment.
This is fixed now and a new snapshot is available. Please try.
View and moderate all "bugs Discussion" comments posted by this user
Mark all as spam, and block user from posting to "Bugs"
Working great! Thanks :-)