tree-sitter / tree-sitter-css

CSS grammar for Tree-sitter
MIT License
85 stars 34 forks source link

::slotted pseudo-element not recognized #29

Closed bennypowers closed 1 year ago

bennypowers commented 2 years ago

The ::slotted(element) selector does not parse up properly.

::slotted(button) {}

actual:

(stylesheet
  (rule_set
    (selectors
      (pseudo_element_selector
        (tag_name)))
    (ERROR
      (UNEXPECTED 'u')
      (to)
      (UNEXPECTED '))
    (block)))

expected (initial draft)

(stylesheet
  (rule_set
    (selectors
      (pseudo_element_selector
        (tag_name)
        (arguments (tag_name)))

compare with csstree:

Screen Shot 2022-07-11 at 20 24 48
derived csstree json ```json { "type": "StyleSheet", "loc": { "source": "", "start": { "offset": 0, "line": 1, "column": 1 }, "end": { "offset": 20, "line": 1, "column": 21 } }, "children": [ { "type": "Rule", "loc": { "source": "", "start": { "offset": 0, "line": 1, "column": 1 }, "end": { "offset": 20, "line": 1, "column": 21 } }, "prelude": { "type": "SelectorList", "loc": { "source": "", "start": { "offset": 0, "line": 1, "column": 1 }, "end": { "offset": 17, "line": 1, "column": 18 } }, "children": [ { "type": "Selector", "loc": { "source": "", "start": { "offset": 0, "line": 1, "column": 1 }, "end": { "offset": 17, "line": 1, "column": 18 } }, "children": [ { "type": "PseudoElementSelector", "loc": { "source": "", "start": { "offset": 0, "line": 1, "column": 1 }, "end": { "offset": 17, "line": 1, "column": 18 } }, "name": "slotted", "children": [ { "type": "Selector", "loc": { "source": "", "start": { "offset": 10, "line": 1, "column": 11 }, "end": { "offset": 16, "line": 1, "column": 17 } }, "children": [ { "type": "TypeSelector", "loc": { "source": "", "start": { "offset": 10, "line": 1, "column": 11 }, "end": { "offset": 16, "line": 1, "column": 17 } }, "name": "button" } ] } ] } ] } ] }, "block": { "type": "Block", "loc": { "source": "", "start": { "offset": 18, "line": 1, "column": 19 }, "end": { "offset": 20, "line": 1, "column": 21 } }, "children": [] } } ] } ```