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

Support for mixed rules and declarations inside at-rules #24

Closed
kizu opened this issue Sep 26, 2016 · 4 comments
Closed

Support for mixed rules and declarations inside at-rules #24

kizu opened this issue Sep 26, 2016 · 4 comments

Comments

@kizu
Copy link

kizu commented Sep 26, 2016

Some CSS modules have mixed rules and declarations inside at-rules. An example: Paged Media Module allowing stuff like this:

@page :first {
  color: green;

  @top-left {
    content: "foo";
    color: blue;
  }
  @top-right {
    content: "bar";
  }
}

Right now CSSTree returns Parse error: Identifier is expected error, while allowing either only declarations or only nested rules.

While this module is still in Editor's Draft, it is quite possible that other modules could allow this kind of syntax (and this could be helpful for external tools too of course).

@lahmatiy
Copy link
Member

Thank you for issue!
Yep, just yesterday thought about the possibility of the rules within the block, and decided that it can be added to the parser, since there is a case in this module. Also this addition will allow to parse some non-standart (yet) things as side effect.
I'm going to implement it soon.

@lahmatiy
Copy link
Member

CSS Syntax Module Level 3 CR says at-rule can be inside a declaration list:
https://www.w3.org/TR/css-syntax-3/#declaration-list-diagram

@kizu
Copy link
Author

kizu commented Oct 24, 2016

Also, could fall into this issue: @apply rule (https://tabatkins.github.io/specs/css-apply-rule/), already implemented under flag (https://www.chromestatus.com/feature/5753701012602880).

The syntax that should be supported for it:

foo {
  --bar: {
    width: 10px;
  };
}

While it is really experimental now and there is chance it would go away/be changed, if adding support for this is not really complicated, then it would be nice to have.

@lahmatiy lahmatiy mentioned this issue Oct 26, 2016
37 tasks
@lahmatiy
Copy link
Member

lahmatiy commented Feb 4, 2017

Looks like issue is solved. Since alpha14 no parse errors. @page at-rule parses as expected. Custom properties value parses as balanced Raw.
Feel free to re-open issue or open new one if there are some other problems.

@lahmatiy lahmatiy closed this as completed Feb 4, 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