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.

Lobotomized owl CSS selector broken

See original GitHub issue

I like to use a pattern of a CSS flex-box with whildren evenly spaced using the lobotomized owl selector.

My CSS looks like this:

  .user-section {
    display: flex;
  }

  .user-section > * + * {
    margin-left: 4px;
  }

Svelte compiles it into this:

.user-section.svelte-1aasoha {
  display: flex
}

.user-section>*+.svelte-1aasoha {
  margin-left: 4px
}

The right eye of the owl is replaced with the unique Svelte-generated selector id for the flexbox. I expected the unique id to be appended to the flexbox selector before the > part of the selector.

Is the id just naively appended to the end of the selector? Maybe a whitespace collapse is set to happen too early when handling this selector.

Svelte version: 3.5.3

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

3reactions
Conduitrycommented, Sep 24, 2020

~ / + should now be getting scoped properly in v3.27.0.

0reactions
Conduitrycommented, Jan 20, 2020

I was just thinking about this more, and there seem to be a lot more things to worry about with sibling selectors than with the other ones. For example:

{#each foo as bar}
	<div class='a'>...</div>
	<div class='b'>...</div>
{/each}

then .b + .a is a valid selector, because the loop will wrap around. In general, there seems to be a large number of cases to cover when deciding whether two elements can be (adjacent or non-adjacent) siblings when {#if}s/{#each}s/{:else}s/{#await}s become involved.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Axiomatic CSS and Lobotomized Owls - A List Apart
Called the “lobotomized owl selector” for its resemblance to an owl's vacant stare, it proved to be the most popular section of my...
Read more >
Axiomatic CSS and the Lobotomized Owl Selector (* + *)
One thing I have noticed, is that the owl selector matches <body> element, because body is actually a sibling to the <head> element....
Read more >
Get to Know The Lobotomized Owl Selector - Pine
The lobotomized owl selector is an exciting CSS concept which helps you make a decent content flow in your design with just a...
Read more >
An ode to the CSS owl selector - DEV Community ‍ ‍
"Solving solutions in CSS can be easy or elegant." The lobotomized owl selector. Heydon explains the selector better in his article than I...
Read more >
Lobotomized Owls - CSS-Tricks
But I didn't come to any stunning conclusion in that article. The best I came up with was a kinda gross compound selector...
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