GithubHelp home page GithubHelp logo

Comments (7)

phax avatar phax commented on June 2, 2024

You are confusing escaping on the input stream and escaping in URLs - this is done based on different syntaxes.
The URL escaping is defined at https://www.w3.org/TR/css-syntax-3/#consume-url-token and it is okay.
The escaping of \xxxxxx is done directly in the jjtree file.

from ph-css.

shagkur avatar shagkur commented on June 2, 2024

I can't fully follow you 😞 Currently browser can handle such escaped values in the url() function by unescaping them according to the unescpae diagram. And i belive that's the "shortcoming" right now of the unescapeURL method. Not sure, if it'd make sense to have the "new" unescape logic extracted into a general unescape method to be able to use it for other CSS values to be unescaped.
Although this issue really references the current improper unescaping of the URL value.
So to me it seems your current approach in your alternate-fix-91 branch is fine.

from ph-css.

phax avatar phax commented on June 2, 2024

Well, there are 2 layers of unescaping when reading CSS. There is one top-level unescaping that can be used everywhere.
https://www.w3.org/TR/css-syntax-3/#input-preprocessing is used for all bytes on all areas. It's like a "filter InputStream". That should be handled on a different level of reading the CSS.
Additionally there is a special escaping for URLs - as defined by https://www.w3.org/TR/css-syntax-3/#consume-url-token and implemented in unescapeURL.

I will create some more tests to see what the exact status of the implementation is

from ph-css.

shagkur avatar shagkur commented on June 2, 2024

Ahh i see. However, for unescapeURL if a REVERSE SOLIDUS () is detected it is required to unescape the code point according to https://www.w3.org/TR/css-syntax-3/#consume-url-token. And this unescaping has to based on https://drafts.csswg.org/css-syntax/#escape-diagram (https://www.w3.org/TR/css-syntax-3/#consume-an-escaped-code-point). Therefore i'd say your implementation, in alternate-fix-91 for unescapeURL is correct. But i agree my assumption this mehod could be used for other CSS values, during the parsing/processing is probably wrong.

from ph-css.

phax avatar phax commented on June 2, 2024

I am trying a totally different approach. I am doing the unescaping at the point where the stream is read (in class CSSCharStream). This however interferes with a lot of existing tests (and IE hacks like \0 or \9), which further complicates the process. So I am on it, but give me some time.

from ph-css.

shagkur avatar shagkur commented on June 2, 2024

Sure, no worries. Meanwhile we've a quick-fix hack on our side to fix this \2f escape issue. But thanks alot for the update. Looking forward to new release then 😄

from ph-css.

stale avatar stale commented on June 2, 2024

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

from ph-css.

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.