muskitty-cssom
CSS Object Model (CSSOM) data structures and serialization, implementing
CSSOM Level 1 on top of
muskitty-css-parser.
Part of the MusKitty browser engine project.
Status
| Component | Spec | Tests |
|---|---|---|
| CssStyleDeclaration + CssDeclaration | §8.5 / §8.6 | 10 |
| CssRule enum (9 variants) | §8.4 | 13 |
| CssStyleSheet container | §8.1 | 5 |
| Parser → CSSOM conversion | §8.4 / §8.6 | 20 |
| Serialization (ToCss trait) | §3 / §8.4-§8.6 | 19+ |
| Total | 81 |
- Zero
unsafecode - Zero C/C++ dependencies
- One-way conversion: parser
Stylesheet→ CSSOMCssStyleSheet - Rust stable toolchain only
- MSRV 1.82
Installation
[]
= "0.1.0"
Quick Start
use ;
use parse_stylesheet;
let parsed = parse_stylesheet;
let sheet: CssStyleSheet = from_stylesheet;
Architecture
muskitty-cssom/
src/
lib.rs Public API + re-exports
stylesheet.rs CssStyleSheet + Origin (§8.1)
rule.rs CssRule enum + 9 rule types (§8.4)
declaration.rs CssStyleDeclaration / CssDeclaration (§8.5 / §8.6)
convert.rs Parser Stylesheet → CSSOM CssStyleSheet
serialize.rs ToCss trait + serialization (§3 / §8.4-§8.6)
tests/
2 test files, 81 tests total
Design Principles
- One-way conversion — Parser output flows into CSSOM; CSSOM is independent and does not reference parser types.
- Enum over trait objects — CSSOM rule types use an enum for value semantics and clear pattern matching.
- CSSWG is ground truth — Implementation follows the spec exactly.
- Zero unsafe — Pure safe Rust.
License
Licensed under the Apache License, Version 2.0. See LICENSE for details.
Copyright 2026 MusCat / MusKitty Bit-Torch Community