Open iidear opened 5 years ago
CSSOM defines APIs (including generic parsing and serialization rules) for Media Queries, Selectors, and of course CSS itself. CSSOM
示例
css 源代码
h1.title {
font-size: 24px;
color: red;
}
section .container {
width: 100%;
border: 1px solid #DDD;
}
解析结果
{
parentStyleSheet: null,
cssRules: [
{
parentRule: null,
parentStyleSheet: "../..",
selectorText: "h1.title",
style: {
0: "font-size",
1: "color",
length: 2,
parentRule: "..",
_importants: {
"font-size": "",
color: ""
},
__starts: 9,
"font-size": "24px",
color: "red"
},
__starts: ,
__ends: 45
},
{
parentRule: null,
parentStyleSheet: "../..",
selectorText: "section .container",
style: {
0: "width",
1: "border",
length: 2,
parentRule: "..",
_importants: {
width: "",
border: ""
},
__starts: 66,
width: "100%",
border: "1px solid #DDD"
},
__starts: 47,
__ends: 110
}
]
}