Skip to content

nesting selector doesn't work if it was wrapped by @container query #10322

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

Closed
JabSYsEmb opened this issue Jan 28, 2024 · 3 comments
Closed

nesting selector doesn't work if it was wrapped by @container query #10322

JabSYsEmb opened this issue Jan 28, 2024 · 3 comments

Comments

@JabSYsEmb
Copy link

Describe the bug

The nesting selector functionality appears to be non-operational when utilized within a container query.

Reproduction

repl: https://svelte.dev/repl/c467cfb38bc64e94b8fc28a7a1b41c12?version=4.2.9

<script>
  let name = "world";
</script>

<div>
  <h1 title="test">Hello {name}!</h1>
</div>

<style>
  div {
    container: resp / inline-size;
  }

  div { /* works fine */
    & h1[title] {
      color: red;
    }
  }

  @container resp (width < 300px) {
    h1[title] {
      color: blue !important;
    }


		/* doesn't work fine */ 
    /* div { 
			& h1[title] {
				color: red;
			}
		} */
  }
</style>

Logs

Error: end must be greater than start
    remove [email protected]:41732
    minify [email protected]:43196
    minify [email protected]:43194
    render [email protected]:43399
    render [email protected]:43396
    dom [email protected]:38151
    compile [email protected]:45626
    Immutable 2
        transform
        runHook
index-vVM6uc9D.js:64:4649
    jg Immutable

System Info

svelte.dev

Severity

annoyance

@Conduitry
Copy link
Member

CSS nesting doesn't properly work yet as a whole - #8587. Your first example only appears to work in this case - the h1[title] is not properly scoped. The CSS in question compiles to div.svelte-18sf3ua{& h1[title] { color: red; }}, which will also incorrectly match h1[title] elements in child components that are inside this component's <div>.

@Conduitry Conduitry closed this as not planned Won't fix, can't repro, duplicate, stale Jan 28, 2024
@AlbertMarashi
Copy link

#9549 should fix this

@JabSYsEmb
Copy link
Author

@AlbertMarashi , thanks for the info I will keep an eye on this fix.

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

No branches or pull requests

3 participants