GithubHelp home page GithubHelp logo

Comments (6)

ylafon avatar ylafon commented on September 15, 2024 1

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.

ylafon avatar ylafon commented on September 15, 2024

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.

dd8 avatar dd8 commented on September 15, 2024

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.

ylafon avatar ylafon commented on September 15, 2024

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.

dd8 avatar dd8 commented on September 15, 2024

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.

ylafon avatar ylafon commented on September 15, 2024

Fixed by #349

from css-validator.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.