Skip to content

Is escaping supposed to work with @supports?  #3059

@JayPanoz

Description

@JayPanoz

Much to my surprise, since @supports is bubbling like @media, it seems that you can’t use any arbitrary string as a variable value for it.

While

@min768: ~"(min-width: 768px)";
.element {
  @media @min768 {
    font-size: 1.2rem;
  }
}

results in

@media (min-width: 768px) {
  .element {
    font-size: 1.2rem;
  }
}

Escaping a string with @supports

@test: ~"(font-variant-caps: small-caps)";

.small-caps {
  @supports @test {
    font-variant-caps: small-caps;
  }
}

results in

@supports @test {
  .small-caps {
    font-variant-caps: small-caps;
  }
}

It failed in any implementation I tried (more or less 20) so I guess this is probably a core issue/feature request?

Is this result to be expected?

Problem is you can have awful feature queries like

@supports ((-ms-font-feature-settings: 'dlig') or (-webkit-font-variant-ligatures: discretionary-ligatures) or (font-variant-ligatures: discretionary-ligatures))

and escaping would be very welcome for such cases, especially as people discover @supports with the grid spec, Open Type features and stuff.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions