Giter Site home page Giter Site logo

Comments (2)

kemaldaggen avatar kemaldaggen commented on July 22, 2024

Hey @andreinitescu, thanks for the input. We thought about it too. But finally decided with a custom CSS parser.
Besides the obvious server side css parsing benefits, here are our reasons for not to use CSSOM:

  • Browser compatibility issues. Even on MDN page, they retrained to include a table due to many incompatibilities across different browser vendors
  • CSSOM requires you to actually put css into the page in order to get underlying object. While there are hacky methods to implement a usual interface to this hack, still doing a normal parsing seemed better.
  • CSS syntax is rather easy to parse.

But you are right, if we have programmatic direct access to browser's internal css parser, that would be way better.

from css.js.

andreinitescu avatar andreinitescu commented on July 22, 2024

Thank you Kemal.
I'm mostly worried about first one, compatibility across browsers.
Do you have any more info regarding that, any quick example which comes to your mind?

In order to parse CSS by CSSOM using a <style> element , I see the CSSOM objects and properties required are LinkStyle.sheet, CSSStyleSheet.cssRules, CSSStyleRule.style, CSSStyleDeclaration, which all seem from DOM Level 2 specification.
But maybe I'm missing something.

from css.js.

Related Issues (19)

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.