question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

core: create a chained selector with :global

See original GitHub issue

The current global selector creates a style that is a parent selector

':global(.parent)': {
  color: 'red',
},
.parent .fztiaq5 {
  color: red;
}

The above will work with

<div class="parent">
  <div class=" .fztiaq5" />
</div>

How can one created a chained class selector with Griffel ?

.same-element.fztiaq5 {
  color: red;
}
<div class=".same-element .fztiaq5" />

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:12 (12 by maintainers)

github_iconTop GitHub Comments

1reaction
layershiftercommented, Sep 27, 2022

After spending some time and thinking about I came to following conclusion: there is no need in this feature as it’s already there.

For example, you can’t create .foo.f1lw17ff, but you can .f1lw17ff.foo (no difference from CSS perspective):

 makeStyles({
  root: {
    '&.foo': { color: 'red' }
  },
});

There is a problem with elements as we produce an invalid selector:

makeStyles({
  root: {
    '&body': { color: 'red' }
  },
})
.f115m9dlbody { /* 🤯 */
  color: red;
}

I created a separate issue for it (#222).

1reaction
ling1726commented, Aug 5, 2022

👀

image

Read more comments on GitHub >

github_iconTop Results From Across the Web

Combinators - Learn web development | MDN
The final selectors we will look at are called combinators, because they combine other selectors in a way that gives them a useful...
Read more >
Selectors - W3C
A selector is a chain of one or more simple selectors separated by combinators. Combinators are: white space, ">", and "+". White space...
Read more >
CSS :not() with Multiple Classes
Say you want to select an element when it doesn't have a certain class. That's what the :not() selector is for. body:not(.home) {...
Read more >
Complex Query Operators - EF Core - Microsoft Learn
The LINQ SelectMany operator allows you to enumerate over a collection selector for each outer element and generate tuples of values from each ......
Read more >
Composing styles for local classes chained with global ones is ...
So imported in js a will contain a b string. Only simple selector with one class make sense and only one class is...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found