Hi,
A lof of developers must support old browsers (e.g. banking applications). I think it will be nice if the parser will treat attributes with star prefix as standard attributes.
Example:
rule{display:"this value is not supported by IE7";new-browsers-attribute1:"this attribute is ignored by IE7";new-browsers-attribute2:"this attribute is ignored by IE7";*display:"old stuff for IE7 compatibility";}
Regards
Last edit: Adam Gabryś 2016-05-27
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi Adam,
thanks for the fast answer. Hope i got your point now.
There is a new snapshot available that supports a switch to enable start hack support. Hope that does the job for you.
Last edit: RBRi 2016-12-30
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Caused by: org.w3c.css.sac.CSSParseException: Error in declaration. '*' is not allowed as first char of a property.
at com.steadystate.css.parser.AbstractSACParser.toCSSParseException(AbstractSACParser.java:264)
at com.steadystate.css.parser.SACParserCSS3.declaration(SACParserCSS3.java:2216)
at com.steadystate.css.parser.SACParserCSS3.styleDeclaration(SACParserCSS3.java:2142)
at com.steadystate.css.parser.SACParserCSS3.styleRule(SACParserCSS3.java:1347)
at com.steadystate.css.parser.SACParserCSS3.styleSheetRuleList(SACParserCSS3.java:174)
at com.steadystate.css.parser.SACParserCSS3.styleSheet(SACParserCSS3.java:56)
at com.steadystate.css.parser.AbstractSACParser.parseStyleSheet(AbstractSACParser.java:282)
at com.steadystate.css.parser.SACParserCSS3.parseStyleSheet(SACParserCSS3.java:31)
at com.steadystate.css.parser.CSSOMParser.parseStyleSheet(CSSOMParser.java:136)
at biz.gabrys.maven.plugins.css.splitter.steadystate.SteadyStateParser.parse(SteadyStateParser.java:45)
... 27 more
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Sorry, I forgot to set setIeStarHackAccepted property.
I see an entry in logs: [WARNING] [5:5] Error in declaration. '*' is not allowed as first char of a property.
Can you stop calling ErrorHandler#warning when this property is enabled?
And last thing ;-) Is there any chance that you will provide a common interface for all parsers? Now I use this code to create parsers:
Ok, have added the SACParser interface as extension of Parser and as the interface implemented by AbstractSACParser.
Regarding the waring i think it it ok to send out the warning for two reasons
1. it is really an invalid css
2. because cssparser stores the star as part of the property name the user has to take care of this
What is your problem with the warning?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I upgraded CSS Parser the latest SNAPSHOT. The SACParser exists but it's not visible (not public). In addition it seems to me that AbstractSACParser still implements Parser instead of SACParser.
About warning, I think that the following strategy would be good: if user didn't enable hack support, then the error should occur - because CSS is invalid if user enabled hack support, then no warning should be displayed - because user knows that CSS contains invalid code (the reason why user enabled hack support). For now user will see a lot of warnings which will be ignored, because user wants that code. For me a warning is something what I should fix, not ignore.
What do you think?
Last edit: Adam Gabryś 2016-12-31
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Sorry but there are no plans for a release this year :-)
For the release i like to add the calc support - if possible the release will be available in Jan 2017,
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Ok, I see in changelog (http://cssparser.sourceforge.net/changes-report.html#a0.9.21) that it will work only for CSS 2.1 and 3.0. So I will adjust my code.
Best regards
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Last edit: Philip John 2016-04-19
The parser does not support star hack property of IE 7.
div {
*display: inline;
}
The above section in CSS throws the following error .
Error in declaration. '' is not allowed as first char of a property.
Last edit: Philip John 2016-04-19
Hi,
what do you expect in this case?
All modern browsers are ignoring this rule also.
Hi,
A lof of developers must support old browsers (e.g. banking applications). I think it will be nice if the parser will treat attributes with star prefix as standard attributes.
Example:
Regards
Last edit: Adam Gabryś 2016-05-27
Hi Philip/Adam,
sorry for getting back that late. Is this still an issue for you?
Last edit: RBRi 2016-12-29
Hi,
This issue was reported by Philip to my tool responsible for spliting CSS stylesheets to smaller files: https://github.com/gabrysbiz/css-splitter-maven-plugin/issues/8
For me it is not a problem (I don't develop any project which operates on CSS files) , but it will be nice if my tool can support it :-)
Hi Adam,
thanks for the fast answer. Hope i got your point now.
There is a new snapshot available that supports a switch to enable start hack support. Hope that does the job for you.
Last edit: RBRi 2016-12-30
Hi,
Unfortunatelly it does not work. I upgraded parser to 0.9.21-SNAPSHOT and tried to parse:
The parser threw exception:
Sorry, I forgot to set
setIeStarHackAccepted
property.I see an entry in logs:
[WARNING] [5:5] Error in declaration. '*' is not allowed as first char of a property.
Can you stop calling
ErrorHandler#warning
when this property is enabled?And last thing ;-) Is there any chance that you will provide a common interface for all parsers? Now I use this code to create parsers:
I want to set star hack property, so I have to do something like this:
I tried to use AbstractSACParser (which defines that property) but it's visibiliti is equal to
package
Code like this will be very nice:
Ok, have added the SACParser interface as extension of Parser and as the interface implemented by AbstractSACParser.
Regarding the waring i think it it ok to send out the warning for two reasons
1. it is really an invalid css
2. because cssparser stores the star as part of the property name the user has to take care of this
What is your problem with the warning?
I upgraded CSS Parser the latest SNAPSHOT. The
SACParser
exists but it's not visible (not public). In addition it seems to me thatAbstractSACParser
still implementsParser
instead ofSACParser
.About warning, I think that the following strategy would be good:
if user didn't enable hack support, then the error should occur - because CSS is invalid
if user enabled hack support, then no warning should be displayed - because user knows that CSS contains invalid code (the reason why user enabled hack support). For now user will see a lot of warnings which will be ignored, because user wants that code. For me a warning is something what I should fix, not ignore.
What do you think?
Last edit: Adam Gabryś 2016-12-31
The SACParser interface is now public, SNAPSHOT is updated; sorry.
Ok, warning gone, snapshot is new.
View and moderate all "bugs Discussion" comments posted by this user
Mark all as spam, and block user from posting to "Bugs"
It works! Thank you very much for your work.
When do you plan to release 0.9.21?
Sorry but there are no plans for a release this year :-)
For the release i like to add the calc support - if possible the release will be available in Jan 2017,
View and moderate all "bugs Discussion" comments posted by this user
Mark all as spam, and block user from posting to "Bugs"
No problem :-) I was just curious.
Happy new year.
View and moderate all "bugs Discussion" comments posted by this user
Mark all as spam, and block user from posting to "Bugs"
Sorry, one more thing.
I wrote some tests and I realized that star hack works only for CSS21 and CSS3 parsers. For CSS1 and CSS2 it throws exception:
Tested CSS:
Hi,
I created some tests. Maybe they will be useful for you:
https://github.com/gabrysbiz/css-splitter-maven-plugin/blob/feature/%2318/src/test/java/biz/gabrys/maven/plugins/css/splitter/steadystate/AbstractStarHackTest.java
https://github.com/gabrysbiz/css-splitter-maven-plugin/blob/feature/%2318/src/test/java/biz/gabrys/maven/plugins/css/splitter/steadystate/Css10StarHackTest.java
https://github.com/gabrysbiz/css-splitter-maven-plugin/blob/feature/%2318/src/test/java/biz/gabrys/maven/plugins/css/splitter/steadystate/Css20StarHackTest.java
https://github.com/gabrysbiz/css-splitter-maven-plugin/blob/feature/%2318/src/test/java/biz/gabrys/maven/plugins/css/splitter/steadystate/Css21StarHackTest.java
https://github.com/gabrysbiz/css-splitter-maven-plugin/blob/feature/%2318/src/test/java/biz/gabrys/maven/plugins/css/splitter/steadystate/Css30StarHackTest.java
Whole project:
https://github.com/gabrysbiz/css-splitter-maven-plugin/tree/feature/%2318
Build: mvn -e compile test
Last edit: Adam Gabryś 2017-01-08
Ok, I see in changelog (http://cssparser.sourceforge.net/changes-report.html#a0.9.21) that it will work only for CSS 2.1 and 3.0. So I will adjust my code.
Best regards