swc/css/parser/tests/fixture/value/quotes/output.json
Alexander Akait 75e6e08e14
refactor(css/ast): Refactor complex selector to represent all css (#2660)
swc_css_ast:
 - Add a type to represent a child of `ComplexSelector`.
2021-11-08 00:29:25 +09:00

956 lines
24 KiB
JSON

{
"type": "Stylesheet",
"span": {
"start": 0,
"end": 993,
"ctxt": 0
},
"rules": [
{
"type": "StyleRule",
"span": {
"start": 0,
"end": 878,
"ctxt": 0
},
"selectors": {
"type": "SelectorList",
"span": {
"start": 0,
"end": 9,
"ctxt": 0
},
"children": [
{
"type": "ComplexSelector",
"span": {
"start": 0,
"end": 9,
"ctxt": 0
},
"children": [
{
"type": "CompoundSelector",
"span": {
"start": 0,
"end": 9,
"ctxt": 0
},
"nestingSelector": null,
"typeSelector": {
"type": "TypeSelector",
"span": {
"start": 0,
"end": 1,
"ctxt": 0
},
"prefix": null,
"name": {
"type": "Text",
"span": {
"start": 0,
"end": 1,
"ctxt": 0
},
"value": "a",
"raw": "a"
}
},
"subclassSelectors": [
{
"type": "PseudoSelector",
"span": {
"start": 1,
"end": 9,
"ctxt": 0
},
"isElement": true,
"name": {
"type": "Text",
"span": {
"start": 3,
"end": 9,
"ctxt": 0
},
"value": "before",
"raw": "before"
},
"args": {
"type": "Tokens",
"span": {
"start": 0,
"end": 0,
"ctxt": 0
},
"tokens": []
}
}
]
}
]
}
]
},
"block": {
"type": "Block",
"span": {
"start": 10,
"end": 878,
"ctxt": 0
},
"items": [
{
"type": "Declaration",
"span": {
"start": 16,
"end": 70,
"ctxt": 0
},
"property": {
"type": "Text",
"span": {
"start": 16,
"end": 23,
"ctxt": 0
},
"value": "content",
"raw": "content"
},
"value": [
{
"type": "String",
"span": {
"start": 25,
"end": 70,
"ctxt": 0
},
"value": "This string is demarcated by double quotes.",
"raw": "\"This string is demarcated by double quotes.\""
}
],
"important": null
},
{
"type": "Declaration",
"span": {
"start": 76,
"end": 130,
"ctxt": 0
},
"property": {
"type": "Text",
"span": {
"start": 76,
"end": 83,
"ctxt": 0
},
"value": "content",
"raw": "content"
},
"value": [
{
"type": "String",
"span": {
"start": 85,
"end": 130,
"ctxt": 0
},
"value": "This string is demarcated by single quotes.",
"raw": "'This string is demarcated by single quotes.'"
}
],
"important": null
},
{
"type": "Declaration",
"span": {
"start": 136,
"end": 196,
"ctxt": 0
},
"property": {
"type": "Text",
"span": {
"start": 136,
"end": 143,
"ctxt": 0
},
"value": "content",
"raw": "content"
},
"value": [
{
"type": "String",
"span": {
"start": 145,
"end": 196,
"ctxt": 0
},
"value": "This is a string with \" an escaped double quote.",
"raw": "\"This is a string with \\\" an escaped double quote.\""
}
],
"important": null
},
{
"type": "Declaration",
"span": {
"start": 202,
"end": 262,
"ctxt": 0
},
"property": {
"type": "Text",
"span": {
"start": 202,
"end": 209,
"ctxt": 0
},
"value": "content",
"raw": "content"
},
"value": [
{
"type": "String",
"span": {
"start": 211,
"end": 262,
"ctxt": 0
},
"value": "This string also has \"an escaped double quote.",
"raw": "\"This string also has \\22 an escaped double quote.\""
}
],
"important": null
},
{
"type": "Declaration",
"span": {
"start": 268,
"end": 328,
"ctxt": 0
},
"property": {
"type": "Text",
"span": {
"start": 268,
"end": 275,
"ctxt": 0
},
"value": "content",
"raw": "content"
},
"value": [
{
"type": "String",
"span": {
"start": 277,
"end": 328,
"ctxt": 0
},
"value": "This is a string with ' an escaped single quote.",
"raw": "'This is a string with \\' an escaped single quote.'"
}
],
"important": null
},
{
"type": "Declaration",
"span": {
"start": 334,
"end": 394,
"ctxt": 0
},
"property": {
"type": "Text",
"span": {
"start": 334,
"end": 341,
"ctxt": 0
},
"value": "content",
"raw": "content"
},
"value": [
{
"type": "String",
"span": {
"start": 343,
"end": 394,
"ctxt": 0
},
"value": "This string also has 'an escaped single quote.",
"raw": "'This string also has \\27 an escaped single quote.'"
}
],
"important": null
},
{
"type": "Declaration",
"span": {
"start": 400,
"end": 457,
"ctxt": 0
},
"property": {
"type": "Text",
"span": {
"start": 400,
"end": 407,
"ctxt": 0
},
"value": "content",
"raw": "content"
},
"value": [
{
"type": "String",
"span": {
"start": 409,
"end": 457,
"ctxt": 0
},
"value": "This is a string with \\ an escaped backslash.",
"raw": "\"This is a string with \\\\ an escaped backslash.\""
}
],
"important": null
},
{
"type": "Declaration",
"span": {
"start": 463,
"end": 522,
"ctxt": 0
},
"property": {
"type": "Text",
"span": {
"start": 463,
"end": 470,
"ctxt": 0
},
"value": "content",
"raw": "content"
},
"value": [
{
"type": "String",
"span": {
"start": 472,
"end": 522,
"ctxt": 0
},
"value": "This string also has Ȫn escaped double quote.",
"raw": "\"This string also has \\22an escaped double quote.\""
}
],
"important": null
},
{
"type": "Declaration",
"span": {
"start": 528,
"end": 589,
"ctxt": 0
},
"property": {
"type": "Text",
"span": {
"start": 528,
"end": 535,
"ctxt": 0
},
"value": "content",
"raw": "content"
},
"value": [
{
"type": "String",
"span": {
"start": 537,
"end": 589,
"ctxt": 0
},
"value": "This string also has \" an escaped double quote.",
"raw": "\"This string also has \\22 an escaped double quote.\""
}
],
"important": null
},
{
"type": "Declaration",
"span": {
"start": 595,
"end": 643,
"ctxt": 0
},
"property": {
"type": "Text",
"span": {
"start": 595,
"end": 602,
"ctxt": 0
},
"value": "content",
"raw": "content"
},
"value": [
{
"type": "String",
"span": {
"start": 604,
"end": 643,
"ctxt": 0
},
"value": "This string has a \nline break in it.",
"raw": "\"This string has a \\Aline break in it.\""
}
],
"important": null
},
{
"type": "Declaration",
"span": {
"start": 649,
"end": 690,
"ctxt": 0
},
"property": {
"type": "Text",
"span": {
"start": 649,
"end": 656,
"ctxt": 0
},
"value": "content",
"raw": "content"
},
"value": [
{
"type": "String",
"span": {
"start": 658,
"end": 690,
"ctxt": 0
},
"value": "A really long awesome string",
"raw": "\"A really long \\\nawesome string\""
}
],
"important": null
},
{
"type": "Declaration",
"span": {
"start": 696,
"end": 717,
"ctxt": 0
},
"property": {
"type": "Text",
"span": {
"start": 696,
"end": 703,
"ctxt": 0
},
"value": "content",
"raw": "content"
},
"value": [
{
"type": "String",
"span": {
"start": 705,
"end": 717,
"ctxt": 0
},
"value": ";'@ /**/\"",
"raw": "\";'@ /**/\\\"\""
}
],
"important": null
},
{
"type": "Declaration",
"span": {
"start": 723,
"end": 739,
"ctxt": 0
},
"property": {
"type": "Text",
"span": {
"start": 723,
"end": 730,
"ctxt": 0
},
"value": "content",
"raw": "content"
},
"value": [
{
"type": "String",
"span": {
"start": 732,
"end": 739,
"ctxt": 0
},
"value": "'\"\\",
"raw": "'\\'\"\\\\'"
}
],
"important": null
},
{
"type": "Declaration",
"span": {
"start": 745,
"end": 760,
"ctxt": 0
},
"property": {
"type": "Text",
"span": {
"start": 745,
"end": 752,
"ctxt": 0
},
"value": "content",
"raw": "content"
},
"value": [
{
"type": "String",
"span": {
"start": 754,
"end": 760,
"ctxt": 0
},
"value": "ab",
"raw": "\"a\\\nb\""
}
],
"important": null
},
{
"type": "Declaration",
"span": {
"start": 766,
"end": 781,
"ctxt": 0
},
"property": {
"type": "Text",
"span": {
"start": 766,
"end": 773,
"ctxt": 0
},
"value": "content",
"raw": "content"
},
"value": [
{
"type": "String",
"span": {
"start": 775,
"end": 781,
"ctxt": 0
},
"value": "ab",
"raw": "\"a\\\nb\""
}
],
"important": null
},
{
"type": "Declaration",
"span": {
"start": 787,
"end": 802,
"ctxt": 0
},
"property": {
"type": "Text",
"span": {
"start": 787,
"end": 794,
"ctxt": 0
},
"value": "content",
"raw": "content"
},
"value": [
{
"type": "String",
"span": {
"start": 796,
"end": 802,
"ctxt": 0
},
"value": "ab",
"raw": "\"a\\\nb\""
}
],
"important": null
},
{
"type": "Declaration",
"span": {
"start": 808,
"end": 823,
"ctxt": 0
},
"property": {
"type": "Text",
"span": {
"start": 808,
"end": 815,
"ctxt": 0
},
"value": "content",
"raw": "content"
},
"value": [
{
"type": "String",
"span": {
"start": 817,
"end": 823,
"ctxt": 0
},
"value": "ab",
"raw": "\"a\\\fb\""
}
],
"important": null
},
{
"type": "Declaration",
"span": {
"start": 829,
"end": 852,
"ctxt": 0
},
"property": {
"type": "Text",
"span": {
"start": 829,
"end": 836,
"ctxt": 0
},
"value": "content",
"raw": "content"
},
"value": [
{
"type": "String",
"span": {
"start": 838,
"end": 852,
"ctxt": 0
},
"value": "ab",
"raw": "\"a\\\n\\\n\\\n\\\f\\\nb\""
}
],
"important": null
},
{
"type": "Declaration",
"span": {
"start": 858,
"end": 875,
"ctxt": 0
},
"property": {
"type": "Text",
"span": {
"start": 858,
"end": 865,
"ctxt": 0
},
"value": "content",
"raw": "content"
},
"value": [
{
"type": "String",
"span": {
"start": 867,
"end": 875,
"ctxt": 0
},
"value": "abc",
"raw": "'a\\62 c'"
}
],
"important": null
}
]
}
},
{
"type": "StyleRule",
"span": {
"start": 880,
"end": 937,
"ctxt": 0
},
"selectors": {
"type": "SelectorList",
"span": {
"start": 880,
"end": 917,
"ctxt": 0
},
"children": [
{
"type": "ComplexSelector",
"span": {
"start": 880,
"end": 917,
"ctxt": 0
},
"children": [
{
"type": "CompoundSelector",
"span": {
"start": 880,
"end": 917,
"ctxt": 0
},
"nestingSelector": null,
"typeSelector": {
"type": "TypeSelector",
"span": {
"start": 880,
"end": 881,
"ctxt": 0
},
"prefix": null,
"name": {
"type": "Text",
"span": {
"start": 880,
"end": 881,
"ctxt": 0
},
"value": "a",
"raw": "a"
}
},
"subclassSelectors": [
{
"type": "AttributeSelector",
"span": {
"start": 881,
"end": 917,
"ctxt": 0
},
"prefix": null,
"name": {
"type": "Text",
"span": {
"start": 882,
"end": 887,
"ctxt": 0
},
"value": "title",
"raw": "title"
},
"matcher": "=",
"value": {
"type": "String",
"span": {
"start": 888,
"end": 916,
"ctxt": 0
},
"value": "a not so very long title",
"raw": "\"a not s\\\no very long title\""
},
"modifier": null
}
]
}
]
}
]
},
"block": {
"type": "Block",
"span": {
"start": 918,
"end": 937,
"ctxt": 0
},
"items": [
{
"type": "Declaration",
"span": {
"start": 924,
"end": 934,
"ctxt": 0
},
"property": {
"type": "Text",
"span": {
"start": 924,
"end": 929,
"ctxt": 0
},
"value": "color",
"raw": "color"
},
"value": [
{
"type": "Text",
"span": {
"start": 931,
"end": 934,
"ctxt": 0
},
"value": "red",
"raw": "red"
}
],
"important": null
}
]
}
},
{
"type": "StyleRule",
"span": {
"start": 938,
"end": 993,
"ctxt": 0
},
"selectors": {
"type": "SelectorList",
"span": {
"start": 938,
"end": 973,
"ctxt": 0
},
"children": [
{
"type": "ComplexSelector",
"span": {
"start": 938,
"end": 973,
"ctxt": 0
},
"children": [
{
"type": "CompoundSelector",
"span": {
"start": 938,
"end": 973,
"ctxt": 0
},
"nestingSelector": null,
"typeSelector": {
"type": "TypeSelector",
"span": {
"start": 938,
"end": 939,
"ctxt": 0
},
"prefix": null,
"name": {
"type": "Text",
"span": {
"start": 938,
"end": 939,
"ctxt": 0
},
"value": "a",
"raw": "a"
}
},
"subclassSelectors": [
{
"type": "AttributeSelector",
"span": {
"start": 939,
"end": 973,
"ctxt": 0
},
"prefix": null,
"name": {
"type": "Text",
"span": {
"start": 940,
"end": 945,
"ctxt": 0
},
"value": "title",
"raw": "title"
},
"matcher": "=",
"value": {
"type": "String",
"span": {
"start": 946,
"end": 972,
"ctxt": 0
},
"value": "a not so very long title",
"raw": "\"a not so very long title\""
},
"modifier": null
}
]
}
]
}
]
},
"block": {
"type": "Block",
"span": {
"start": 974,
"end": 993,
"ctxt": 0
},
"items": [
{
"type": "Declaration",
"span": {
"start": 980,
"end": 990,
"ctxt": 0
},
"property": {
"type": "Text",
"span": {
"start": 980,
"end": 985,
"ctxt": 0
},
"value": "color",
"raw": "color"
},
"value": [
{
"type": "Text",
"span": {
"start": 987,
"end": 990,
"ctxt": 0
},
"value": "red",
"raw": "red"
}
],
"important": null
}
]
}
}
]
}