Comments (6)
invalid escapes and non [a-zA-Z] escapes are not processed so that the regular tokeniser can do its job. Current state is at https://github.com/w3c/css-validator/blob/functionescape/org/w3c/css/util/UnescapeFilterReader.java and seems to work well (will do more tests before merging).
from css-validator.
So doing it properly is pushing JavaCC to its limit, which is the size of generated code. Will have to do a workaround...
from css-validator.
This might be useful: We use a C++ parser generator for our CSS stuff, but use the https://www.w3.org/TR/css-syntax-3/#consume-url-token algorithm to parse url() directly from the input stream when we hit a 'url(' token. We let let the parser continue from the current position in the input stream from the end of the url token.
There might be a way of doing something similar with the JavaCC input stream
from css-validator.
I was thinking of an FilterReader in charge of doing all the unicode unescaping for [a-zA-Z] as it is used in most constructions (url(), var() and other functions, @βrules etc...)
from css-validator.
That could work.
One potential issue is dealing with invalid escapes - for example if you hit an invalid escape in the middle of url() you need to return the baduri
token in https://www.w3.org/TR/2011/REC-CSS2-20110607/grammar.html#scanner or run the 'consume remnants of bad url' algorithm in https://www.w3.org/TR/css-syntax-3/#consume-url-token
from css-validator.
Fixed by #349
from css-validator.
Related Issues (20)
- CSS subgrid support HOT 2
- Error when parsing namespace prefixes
- NullPointerException when using undeclared prefixes HOT 2
- CssSelectors contexts are not computed in CssParseException HOT 1
- UnescapeFilterReader replaces \r with \n causing invalid localization of errors HOT 1
- `rgba()` is dumped as `rgb()` HOT 1
- CSS validator down? HOT 1
- Value Error : font-variant super is not a font-variant value : super HOT 2
- Incorrect css shows as correct HOT 1
- False errors "The types are incompatible" and "Invalid type" HOT 3
- wrong _allowed_values in css3/CssListStyleType
- Possible false validation error "Property d doesn't exist." HOT 1
- Validator doesn't support space as value for custom property HOT 1
- Media query causes unexpected parse error HOT 1
- :has() expects initial combinator when none is required
- 'rotate', 'scale' CSS properties incorrectly reported as 'doesn't exist' HOT 1
- Unrecognized at-rule "@layer"
- CSS variable in clamp() without default value HOT 1
- `filter: invert()` is invalid
- False error in custom variable declaration HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from css-validator.