Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

.a + .b {} and.a > .b don't work #25

Closed
@aalin

Description

@aalin

Hi, I'm unable to parse> and+ in selectors. They seem to get lost...

I haven't attempted to fix this myself, I might do it tomorrow.
Any suggestions on where to start would be appreciated, I'm not at all familiar with the code.

Example:

ppCSS.parse(".a, .b { color: #f0f; }")ppCSS.parse(".a + .b { color: #f0f; }")ppCSS.parse(".a > .b { color: #f0f; }")

Output:

(css-stylesheet  (style-rule    (selectors      (class-selector (ident-token"a")),      (class-selector (ident-token"b"))    )    (declarations      (declaration color (hash-token"f0f" id))    )  ))(css-stylesheet  (style-rule (selectors (class-selector (ident-token"a"))) (declarations (declaration color (hash-token"f0f" id)))))(css-stylesheet  (style-rule (selectors (class-selector (ident-token"a"))) (declarations (declaration color (hash-token"f0f" id)))))

I noticed that@media doesn't seem to be parsed correctly either.
There should probably be astyle-rule instead of asimple-block.

pp CSS.parse(".a { color: #f0f; }")pp CSS.parse("@media (max-width: 1px) { .a { color: #f0f; } }")

Output:

(css-stylesheet  (style-rule (selectors (class-selector (ident-token"a"))) (declarations (declaration color (hash-token"f0f" id)))))(css-stylesheet  (at-rule"media"    (prelude      (whitespace-token""),      (simple-block"(" (ident-token"max-width"), (colon-token), (whitespace-token""), (dimension-token integer1 px)),      (whitespace-token"")    )    (simple-block"{"      (whitespace-token""),      (delim-token"."),      (ident-token"a"),      (whitespace-token""),      (simple-block"{"        (whitespace-token""),        (ident-token"color"),        (colon-token),        (whitespace-token""),        (hash-token"f0f" id),        (semicolon-token),        (whitespace-token"")      ),      (whitespace-token"")    )  ))

Similar issues with@property:

ppCSS.parse(<<~CSS)  @property --angle {    syntax: "<angle>";    inherits: false;    initial-value: 10deg;  }CSS

Output:

(css-stylesheet  (at-rule"property"    (prelude      (whitespace-token""),      (ident-token"--angle"),      (whitespace-token"")    )    (simple-block"{"      (whitespace-token"\n" +""),      (ident-token"syntax"),      (colon-token),      (whitespace-token""),      (string-token"<angle>"),      (semicolon-token),      (whitespace-token"\n" +""),      (ident-token"inherits"),      (colon-token),      (whitespace-token""),      (ident-token"false"),      (semicolon-token),      (whitespace-token"\n" +""),      (ident-token"initial-value"),      (colon-token),      (whitespace-token""),      (dimension-token integer10 deg),      (semicolon-token),      (whitespace-token"\n")    )  ))

Just noticed attribute selectors also get lost..

Input:

ppCSS.parse('.a[aria-current="page"] { color: #f0f; }')

Output:

(css-stylesheet (style-rule (selectors (class-selector (ident-token"a"))) (declarations (declaration color (hash-token"f0f" id)))))

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp