You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
svelte/packages/svelte/tests/parser-modern/samples/css-nth-syntax/output.json

911 lines
18 KiB

{
"css": {
"type": "Style",
"start": 0,
"end": 806,
"attributes": [],
"children": [
{
"type": "Rule",
"prelude": {
"type": "SelectorList",
"start": 60,
"end": 80,
"children": [
{
"type": "Selector",
"start": 60,
"end": 80,
"children": [
{
"type": "TypeSelector",
"name": "h1",
"start": 60,
"end": 62
},
{
"type": "PseudoClassSelector",
"name": "nth-of-type",
"args": {
"type": "SelectorList",
"start": 75,
"end": 79,
"children": [
{
"type": "Selector",
"start": 75,
"end": 79,
"children": [
{
"type": "Nth",
"value": "2n+1",
"start": 75,
"end": 79
}
]
}
]
},
"start": 62,
"end": 80
}
]
}
]
},
"block": {
"type": "Block",
"start": 80,
"end": 112,
"children": [
{
"type": "Declaration",
"start": 90,
"end": 105,
"property": "background",
"value": "red"
}
]
},
"start": 60,
"end": 112
},
{
"type": "Rule",
"prelude": {
"type": "SelectorList",
"start": 117,
"end": 153,
"children": [
{
"type": "Selector",
"start": 117,
"end": 153,
"children": [
{
"type": "TypeSelector",
"name": "h1",
"start": 117,
"end": 119
},
{
"type": "PseudoClassSelector",
"name": "nth-child",
"args": {
"type": "SelectorList",
"start": 130,
"end": 152,
"children": [
{
"type": "Selector",
"start": 130,
"end": 152,
"children": [
{
"type": "Nth",
"value": "-n + 3 of ",
"start": 130,
"end": 140
},
{
"type": "TypeSelector",
"name": "li",
"start": 140,
"end": 142
},
{
"type": "ClassSelector",
"name": "important",
"start": 142,
"end": 152
}
]
}
]
},
"start": 119,
"end": 153
}
]
}
]
},
"block": {
"type": "Block",
"start": 154,
"end": 186,
"children": [
{
"type": "Declaration",
"start": 164,
"end": 179,
"property": "background",
"value": "red"
}
]
},
"start": 117,
"end": 186
},
{
"type": "Rule",
"prelude": {
"type": "SelectorList",
"start": 191,
"end": 206,
"children": [
{
"type": "Selector",
"start": 191,
"end": 206,
"children": [
{
"type": "TypeSelector",
"name": "h1",
"start": 191,
"end": 193
},
{
"type": "PseudoClassSelector",
"name": "nth-child",
"args": {
"type": "SelectorList",
"start": 204,
"end": 205,
"children": [
{
"type": "Selector",
"start": 204,
"end": 205,
"children": [
{
"type": "Nth",
"value": "1",
"start": 204,
"end": 205
}
]
}
]
},
"start": 193,
"end": 206
}
]
}
]
},
"block": {
"type": "Block",
"start": 207,
"end": 239,
"children": [
{
"type": "Declaration",
"start": 217,
"end": 232,
"property": "background",
"value": "red"
}
]
},
"start": 191,
"end": 239
},
{
"type": "Rule",
"prelude": {
"type": "SelectorList",
"start": 244,
"end": 259,
"children": [
{
"type": "Selector",
"start": 244,
"end": 259,
"children": [
{
"type": "TypeSelector",
"name": "h1",
"start": 244,
"end": 246
},
{
"type": "PseudoClassSelector",
"name": "nth-child",
"args": {
"type": "SelectorList",
"start": 257,
"end": 258,
"children": [
{
"type": "Selector",
"start": 257,
"end": 258,
"children": [
{
"type": "TypeSelector",
"name": "p",
"start": 257,
"end": 258
}
]
}
]
},
"start": 246,
"end": 259
}
]
}
]
},
"block": {
"type": "Block",
"start": 260,
"end": 292,
"children": [
{
"type": "Declaration",
"start": 270,
"end": 285,
"property": "background",
"value": "red"
}
]
},
"start": 244,
"end": 292
},
{
"type": "Rule",
"prelude": {
"type": "SelectorList",
"start": 297,
"end": 314,
"children": [
{
"type": "Selector",
"start": 297,
"end": 314,
"children": [
{
"type": "TypeSelector",
"name": "h1",
"start": 297,
"end": 299
},
{
"type": "PseudoClassSelector",
"name": "nth-child",
"args": {
"type": "SelectorList",
"start": 310,
"end": 313,
"children": [
{
"type": "Selector",
"start": 310,
"end": 313,
"children": [
{
"type": "Nth",
"value": "n+7",
"start": 310,
"end": 313
}
]
}
]
},
"start": 299,
"end": 314
}
]
}
]
},
"block": {
"type": "Block",
"start": 315,
"end": 347,
"children": [
{
"type": "Declaration",
"start": 325,
"end": 340,
"property": "background",
"value": "red"
}
]
},
"start": 297,
"end": 347
},
{
"type": "Rule",
"prelude": {
"type": "SelectorList",
"start": 352,
"end": 370,
"children": [
{
"type": "Selector",
"start": 352,
"end": 370,
"children": [
{
"type": "TypeSelector",
"name": "h1",
"start": 352,
"end": 354
},
{
"type": "PseudoClassSelector",
"name": "nth-child",
"args": {
"type": "SelectorList",
"start": 365,
"end": 369,
"children": [
{
"type": "Selector",
"start": 365,
"end": 369,
"children": [
{
"type": "Nth",
"value": "even",
"start": 365,
"end": 369
}
]
}
]
},
"start": 354,
"end": 370
}
]
}
]
},
"block": {
"type": "Block",
"start": 371,
"end": 403,
"children": [
{
"type": "Declaration",
"start": 381,
"end": 396,
"property": "background",
"value": "red"
}
]
},
"start": 352,
"end": 403
},
{
"type": "Rule",
"prelude": {
"type": "SelectorList",
"start": 408,
"end": 425,
"children": [
{
"type": "Selector",
"start": 408,
"end": 425,
"children": [
{
"type": "TypeSelector",
"name": "h1",
"start": 408,
"end": 410
},
{
"type": "PseudoClassSelector",
"name": "nth-child",
"args": {
"type": "SelectorList",
"start": 421,
"end": 424,
"children": [
{
"type": "Selector",
"start": 421,
"end": 424,
"children": [
{
"type": "Nth",
"value": "odd",
"start": 421,
"end": 424
}
]
}
]
},
"start": 410,
"end": 425
}
]
}
]
},
"block": {
"type": "Block",
"start": 426,
"end": 458,
"children": [
{
"type": "Declaration",
"start": 436,
"end": 451,
"property": "background",
"value": "red"
}
]
},
"start": 408,
"end": 458
},
{
"type": "Rule",
"prelude": {
"type": "SelectorList",
"start": 463,
"end": 492,
"children": [
{
"type": "Selector",
"start": 463,
"end": 492,
"children": [
{
"type": "TypeSelector",
"name": "h1",
"start": 463,
"end": 465
},
{
"type": "PseudoClassSelector",
"name": "nth-child",
"args": {
"type": "SelectorList",
"start": 476,
"end": 486,
"children": [
{
"type": "Selector",
"start": 485,
"end": 486,
"children": [
{
"type": "Nth",
"value": "n",
"start": 485,
"end": 486
}
]
}
]
},
"start": 465,
"end": 492
}
]
}
]
},
"block": {
"type": "Block",
"start": 493,
"end": 525,
"children": [
{
"type": "Declaration",
"start": 503,
"end": 518,
"property": "background",
"value": "red"
}
]
},
"start": 463,
"end": 525
},
{
"type": "Rule",
"prelude": {
"type": "SelectorList",
"start": 530,
"end": 544,
"children": [
{
"type": "Selector",
"start": 530,
"end": 544,
"children": [
{
"type": "TypeSelector",
"name": "h1",
"start": 530,
"end": 532
},
{
"type": "PseudoClassSelector",
"name": "global",
"args": {
"type": "SelectorList",
"start": 540,
"end": 543,
"children": [
{
"type": "Selector",
"start": 540,
"end": 543,
"children": [
{
"type": "TypeSelector",
"name": "nav",
"start": 540,
"end": 543
}
]
}
]
},
"start": 532,
"end": 544
}
]
}
]
},
"block": {
"type": "Block",
"start": 545,
"end": 577,
"children": [
{
"type": "Declaration",
"start": 555,
"end": 570,
"property": "background",
"value": "red"
}
]
},
"start": 530,
"end": 577
},
{
"type": "Rule",
"prelude": {
"type": "SelectorList",
"start": 580,
"end": 601,
"children": [
{
"type": "Selector",
"start": 580,
"end": 601,
"children": [
{
"type": "TypeSelector",
"name": "h1",
"start": 580,
"end": 582
},
{
"type": "PseudoClassSelector",
"name": "nth-of-type",
"args": {
"type": "SelectorList",
"start": 595,
"end": 600,
"children": [
{
"type": "Selector",
"start": 595,
"end": 600,
"children": [
{
"type": "Nth",
"value": "10n+1",
"start": 595,
"end": 600
}
]
}
]
},
"start": 582,
"end": 601
}
]
}
]
},
"block": {
"type": "Block",
"start": 601,
"end": 633,
"children": [
{
"type": "Declaration",
"start": 611,
"end": 626,
"property": "background",
"value": "red"
}
]
},
"start": 580,
"end": 633
},
{
"type": "Rule",
"prelude": {
"type": "SelectorList",
"start": 636,
"end": 657,
"children": [
{
"type": "Selector",
"start": 636,
"end": 657,
"children": [
{
"type": "TypeSelector",
"name": "h1",
"start": 636,
"end": 638
},
{
"type": "PseudoClassSelector",
"name": "nth-of-type",
"args": {
"type": "SelectorList",
"start": 651,
"end": 656,
"children": [
{
"type": "Selector",
"start": 651,
"end": 656,
"children": [
{
"type": "Nth",
"value": "-2n+3",
"start": 651,
"end": 656
}
]
}
]
},
"start": 638,
"end": 657
}
]
}
]
},
"block": {
"type": "Block",
"start": 657,
"end": 689,
"children": [
{
"type": "Declaration",
"start": 667,
"end": 682,
"property": "background",
"value": "red"
}
]
},
"start": 636,
"end": 689
},
{
"type": "Rule",
"prelude": {
"type": "SelectorList",
"start": 692,
"end": 711,
"children": [
{
"type": "Selector",
"start": 692,
"end": 711,
"children": [
{
"type": "TypeSelector",
"name": "h1",
"start": 692,
"end": 694
},
{
"type": "PseudoClassSelector",
"name": "nth-of-type",
"args": {
"type": "SelectorList",
"start": 707,
"end": 710,
"children": [
{
"type": "Selector",
"start": 707,
"end": 710,
"children": [
{
"type": "Nth",
"value": "+12",
"start": 707,
"end": 710
}
]
}
]
},
"start": 694,
"end": 711
}
]
}
]
},
"block": {
"type": "Block",
"start": 711,
"end": 743,
"children": [
{
"type": "Declaration",
"start": 721,
"end": 736,
"property": "background",
"value": "red"
}
]
},
"start": 692,
"end": 743
},
{
"type": "Rule",
"prelude": {
"type": "SelectorList",
"start": 746,
"end": 765,
"children": [
{
"type": "Selector",
"start": 746,
"end": 765,
"children": [
{
"type": "TypeSelector",
"name": "h1",
"start": 746,
"end": 748
},
{
"type": "PseudoClassSelector",
"name": "nth-of-type",
"args": {
"type": "SelectorList",
"start": 761,
"end": 764,
"children": [
{
"type": "Selector",
"start": 761,
"end": 764,
"children": [
{
"type": "Nth",
"value": "+3n",
"start": 761,
"end": 764
}
]
}
]
},
"start": 748,
"end": 765
}
]
}
]
},
"block": {
"type": "Block",
"start": 765,
"end": 797,
"children": [
{
"type": "Declaration",
"start": 775,
"end": 790,
"property": "background",
"value": "red"
}
]
},
"start": 746,
"end": 797
}
],
"content": {
"start": 7,
"end": 798,
"styles": "\n /* test that all these are parsed correctly */\n\th1:nth-of-type(2n+1){\n background: red;\n }\n h1:nth-child(-n + 3 of li.important) {\n background: red;\n }\n h1:nth-child(1) {\n background: red;\n }\n h1:nth-child(p) {\n background: red;\n }\n h1:nth-child(n+7) {\n background: red;\n }\n h1:nth-child(even) {\n background: red;\n }\n h1:nth-child(odd) {\n background: red;\n }\n h1:nth-child(\n n\n ) {\n background: red;\n }\n h1:global(nav) {\n background: red;\n }\n\t\th1:nth-of-type(10n+1){\n background: red;\n }\n\t\th1:nth-of-type(-2n+3){\n background: red;\n }\n\t\th1:nth-of-type(+12){\n background: red;\n }\n\t\th1:nth-of-type(+3n){\n background: red;\n }\n"
}
},
"js": [],
"start": 808,
"end": 820,
"type": "Root",
"fragment": {
"type": "Fragment",
"nodes": [
{
"type": "Text",
"start": 806,
"end": 808,
"raw": "\n\n",
"data": "\n\n"
},
{
"type": "RegularElement",
"start": 808,
"end": 820,
"name": "h1",
"attributes": [],
"fragment": {
"type": "Fragment",
"nodes": [
{
"type": "Text",
"start": 812,
"end": 815,
"raw": "Foo",
"data": "Foo"
}
],
"transparent": true
}
}
],
"transparent": false
},
"options": null
}