Skip to content
This repository has been archived by the owner on Aug 6, 2021. It is now read-only.

Bug with brackets ( } { ) in content #15

Open
BTMPL opened this issue Apr 17, 2016 · 2 comments
Open

Bug with brackets ( } { ) in content #15

BTMPL opened this issue Apr 17, 2016 · 2 comments

Comments

@BTMPL
Copy link

BTMPL commented Apr 17, 2016

Using } in a content property breaks the parsing:

.someSelector:after { content: '} broken :) @media (screen) { lol }'; }

@kemaldaggen
Copy link
Contributor

Hey BTMPL, thanks for reporting the issue. Since we are parsing CSS with a regex, this is expected behavior given the nature of solution. I will look into this problem that haunts this project for a long time.

@pygy
Copy link

pygy commented Apr 17, 2016

This can be generalized to all strings, basically. I don't think you can solve this, short of using a traditional lexer/parser. The current approach won't cut it.

Likewise for nested media queries:

@media foo {
  @media bar {
    .someSelector 
    { 
      margin:40px 10px; 
      padding:5px;
    }
  }
}

becomes

[
  {
    "selector": "@media foo",
    "type": "media",
    "subStyles": [
      {
        "selector": "@media bar",
        "type": "media",
        "subStyles": []
      }
    ]
  }
]

Nesting can be arbitrarily deep.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants