Comments (2)
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.
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)
- add npm support HOT 5
- Demo is broken HOT 1
- bug with comments
- Comments are marked as "defective" by default
- Remove bower and fetch dependencies via npm only
- Does css.js care about specificity? HOT 2
- Bug with base64 hack
- Bug with brackets ( } { ) in `content` HOT 2
- Ditch bower
- Stringify HOT 4
- comments are not being parsed as comment
- @media print Bug
- Possible references to domain-specific selector names in applyNamespacing HOT 1
- breaks on semicolon after data:image
- Parser breaks on common templating syntax
- how to modify parsed css?
- A test-example that fails with comments
- ES6 import
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.js.