All Projects β†’ NV β†’ Cssom

NV / Cssom

Licence: mit
CSS Object Model implemented in pure JavaScript. It's also a parser!

Programming Languages

javascript
184084 projects - #8 most used programming language

Labels

Projects that are alternatives of or similar to Cssom

Awesome
πŸš€A curated list of awesome resources related to Alpine.
Stars: ✭ 502 (-27.35%)
Mutual labels:  dom
React Log
React for the Console
Stars: ✭ 553 (-19.97%)
Mutual labels:  dom
Ramjet
Morph DOM elements from one state to another with smooth animations and transitions
Stars: ✭ 5,455 (+689.44%)
Mutual labels:  dom
Testing Playground
🐸 Simple and complete DOM testing playground that encourage good testing practices.
Stars: ✭ 511 (-26.05%)
Mutual labels:  dom
Html2canvas
Screenshots with JavaScript
Stars: ✭ 25,113 (+3534.3%)
Mutual labels:  dom
Displayjs
A simple JavaScript framework for building ambitious UIs 😊
Stars: ✭ 590 (-14.62%)
Mutual labels:  dom
Csshake
CSS classes to move your DOM!
Stars: ✭ 4,531 (+555.72%)
Mutual labels:  dom
Svg
Fork of the ms svg library (http://svg.codeplex.com/)
Stars: ✭ 676 (-2.17%)
Mutual labels:  dom
Cheerio
Fast, flexible, and lean implementation of core jQuery designed specifically for the server.
Stars: ✭ 24,616 (+3462.37%)
Mutual labels:  dom
Nanojs
Minimal standalone JS library for DOM manipulation
Stars: ✭ 636 (-7.96%)
Mutual labels:  dom
Scrollbear
A modern tool that maintains scroll position when images loaded
Stars: ✭ 523 (-24.31%)
Mutual labels:  dom
React Svg
🎨 A React component that injects SVG into the DOM.
Stars: ✭ 536 (-22.43%)
Mutual labels:  dom
Html To Image
βœ‚οΈ Generates an image from a DOM node using HTML5 canvas and SVG.
Stars: ✭ 595 (-13.89%)
Mutual labels:  dom
Motus
Animation library that mimics CSS keyframes when scrolling.
Stars: ✭ 502 (-27.35%)
Mutual labels:  dom
Nanohtml
πŸ‰ HTML template strings for the Browser with support for Server Side Rendering in Node.
Stars: ✭ 651 (-5.79%)
Mutual labels:  dom
Html5 Dom Document Php
A better HTML5 parser for PHP.
Stars: ✭ 477 (-30.97%)
Mutual labels:  dom
Cash
An absurdly small jQuery alternative for modern browsers.
Stars: ✭ 5,714 (+726.92%)
Mutual labels:  dom
Dom4j
flexible XML framework for Java
Stars: ✭ 689 (-0.29%)
Mutual labels:  dom
React Archer
🏹 Draw arrows between React elements πŸ–‹
Stars: ✭ 666 (-3.62%)
Mutual labels:  dom
Nanomorph
πŸš… - Hyper fast diffing algorithm for real DOM nodes
Stars: ✭ 621 (-10.13%)
Mutual labels:  dom

CSSOM

CSSOM.js is a CSS parser written in pure JavaScript. It is also a partial implementation of CSS Object Model.

CSSOM.parse("body {color: black}")
-> {
  cssRules: [
    {
      selectorText: "body",
      style: {
        0: "color",
        color: "black",
        length: 1
      }
    }
  ]
}

Parser demo

Works well in Google Chrome 6+, Safari 5+, Firefox 3.6+, Opera 10.63+. Doesn't work in IE < 9 because of unsupported getters/setters.

To use CSSOM.js in the browser you might want to build a one-file version that exposes a single CSSOM global variable:

➀ git clone https://github.com/NV/CSSOM.git
➀ cd CSSOM
➀ node build.js
build/CSSOM.js is done

To use it with Node.js or any other CommonJS loader:

➀ npm install cssom

Don’t use it if...

You parse CSS to mungle, minify or reformat code like this:

div {
  background: gray;
  background: linear-gradient(to bottom, white 0%, black 100%);
}

This pattern is often used to give browsers that don’t understand linear gradients a fallback solution (e.g. gray color in the example). In CSSOM, background: gray gets overwritten. It does NOT get preserved.

If you do CSS mungling, minification, or image inlining, considere using one of the following:

Tests

To run tests locally:

➀ git submodule init
➀ git submodule update

Who uses CSSOM.js

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].