CSSOM
CSSOM copied to clipboard
Unmaintained! ⚠️ CSS Object Model implemented in pure JavaScript. Also, a CSS parser.
crash at parsing ``` js var CSSOM = require('cssom'); var css; try { css = CSSOM.parse(` @-moz-document url-prefix() { @media only screen{ #main { color:red; } } } `); console.log(css);...
It's not uncommon for CSS authors to take advantage of the fact that a browser must ignore a CSS property in its entirety if a parse error or unsupported token...
This CSS: ``` .block-title .block-title-inner a:visited { color: #48484d; } // MAIN MENU - (used to keep mobile menu options hidden and keep weather/search and menu on one line) //...
I don't know if it's a valid syntax according to W3C specifications but I sometimes see assignments like `visibility:`. It seems these kind of assignments make the CSS elements disappear,...
[Backslash escape sequences](http://www.w3.org/TR/css3-syntax/#characters) currently aren't handled.
I am going to use your parser for CSS sprites generator. It would be convenient to parse comments as properties annotations like in the following example: ``` css .icon {...
@charset rule currently ends up being part of a selector: @charset "UTF-8"; html,section { margin:0; padding:0; border:0 } E.g. one of the GitHub CSS files: https://a248.e.akamai.net/assets.github.com/assets/github-0c9d87dff5611078dcc29621367346a73a74b001.css
[Travis CI: Node.js](http://about.travis-ci.org/docs/user/languages/javascript-with-nodejs/). [Testling](http://ci.testling.com/) for browsers.
Browsers mostly store longhand properties rather than shortcuts. When you write `background: rgb(40, 40, 40)` WebKit stores it as ``` style: 0: "background-image" 1: "background-repeat-x" 2: "background-repeat-y" 3: "background-attachment" 4:...
/* button.css */ .button { display: inline-block; text-align: right; /* fixes Opera */ /* background-image defined in button-theme.css */ background: no-repeat 100% -55px; } var css = CSSOM.parse(buttonCSS, {preserveFormatting: true})...