Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong Sass parsing of nested properties, marks it as pseudoClass #264

Open
AleshaOleg opened this issue Apr 10, 2017 · 2 comments
Open

Wrong Sass parsing of nested properties, marks it as pseudoClass #264

AleshaOleg opened this issue Apr 10, 2017 · 2 comments

Comments

@AleshaOleg
Copy link

AleshaOleg commented Apr 10, 2017

Let's explain bug in example. Here it is:

p
    :border
      :style dotted

GPE, should mark this one as nested property, but border and style returning as two different blocks. In addition to border marked as pseudoClass what is wrong.

Sass have this feature as Nested Properties. You can read more there.

GPE playground or with gonzales.parse(source, {syntax: 'sass', rule: 'declaration'});, produce this AST:

{
  "type": "stylesheet",
  "content": [
    {
      "type": "ruleset",
      "content": [
        {
          "type": "selector",
          "content": [
            {
              "type": "typeSelector",
              "content": [
                {
                  "type": "ident",
                  "content": "p"
                }
              ]
            }
          ]
        },
        {
          "type": "space",
          "content": "\n"
        },
        {
          "type": "block",
          "content": [
            {
              "type": "space",
              "content": "    "
            },
            {
              "type": "ruleset",
              "content": [
                {
                  "type": "selector",
                  "content": [
                    {
                      "type": "pseudoClass",
                      "content": [
                        {
                          "type": "ident",
                          "content": "border"
                        }
                      ]
                    }
                  ]
                },
                {
                  "type": "space",
                  "content": "\n"
                },
                {
                  "type": "block",
                  "content": [
                    {
                      "type": "space",
                      "content": "      "
                    },
                    {
                      "type": "declaration",
                      "content": [
                        {
                          "type": "propertyDelimiter",
                          "content": ":"
                        },
                        {
                          "type": "property",
                          "content": [
                            {
                              "type": "ident",
                              "content": "style"
                            }
                          ]
                        },
                        {
                          "type": "space",
                          "content": " "
                        },
                        {
                          "type": "value",
                          "content": [
                            {
                              "type": "ident",
                              "content": "dotted"
                            }
                          ]
                        }
                      ]
                    }
                  ]
                }
              ]
            }
          ]
        }
      ]
    }
  ]
}

This code is analogue for:

p
    border-style: dotted
@AleshaOleg
Copy link
Author

AleshaOleg commented Apr 10, 2017

Unfortunately not everything in Sass, marked with colon is pseudo-class.
https://github.com/tonyganch/gonzales-pe/blob/dev/src/sass/stringify.js#L84

@AleshaOleg
Copy link
Author

I'm ready to fix this issue, could anybody give a advice in which part of this file, i should watch?

@AleshaOleg AleshaOleg changed the title Wrong parsing of nested properties, marks it as pseudoClass Wrong Sass parsing of nested properties, marks it as pseudoClass May 3, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants