NV / CSSOM

Unmaintained! ⚠️ CSS Object Model implemented in pure JavaScript. Also, a CSS parser.
https://nv.github.io/CSSOM/docs/parse.html
MIT License
751 stars 99 forks source link

Why it can not parse (div span a{color: #789}) into tree nodes? #101

Closed jackiewillen closed 4 years ago

jackiewillen commented 4 years ago

For Example.When i have a css like this. div span a {color: #789}; It need to build a cssom like this body ->div->span->a with four nodes。as below: { parentNode: body, children: { parentNode: div, children: { parentNode: span, children: { node: a } } } }

Why the CSSOM just generate one object property like below?

{ parentStyleSheet: null,
cssRules: [
{
parentRule: null,
parentStyleSheet: "../..",
selectorText: "div span a",
style: {
0: "color",
length: 1,
parentRule: "..",
_importants: { color: "" },
starts: 7,
color: "#789" },
starts: , __ends: 20 } ] }

NV commented 4 years ago

That's not how CSSOM works. The current output is correct.