dperini / nwsapi

Fast CSS Selectors API Engine
MIT License
103 stars 35 forks source link

fix: bypass descendant combinator typeerror #78

Closed computnik closed 1 year ago

computnik commented 1 year ago

Motivation and context:

The nwsapi parsing gives TypeError in cases like below:

  &:disabled {
      svg path {
          fill: var(--color-brand-primary)
      } 
  }

image TypeError: Cannot read properties of null (reading 'parentElement')

This change checks for null value when parsing the Descendant combinator, and can potentially bypass TypeErrors like in #75

dperini commented 1 year ago

@computnik I changed strategy for resolving combinators for when there are extreme combinators nesting. At each nesting level a new variable is created/retained so it will be impossible to overwrite them. See this commit 12f9f59