CSS selector bug
I thought I was going insane
In a popup, apply a sibling selector (
~
) , e.g. https://codepen.io/vescoyez/pen/wMyRLP?editors=1100
It appears that Plasmo uses autoprefixer
to only apply -moz-
selectors, but no prefix-free ones, despite running
40 Replies
FYI it occurs whether my
<style>
has lang="scss"
or not
FYI when I apply :placeholder-shown
without ~
, it doesn't apply the -moz-
prefix
@louis Any chance to solve it soon?so it doesn't work if you do
input:placeholder-shown?
?It does work
It fails to work when I use
~
Does it work if it's not embedded as a svelte style?
That's what I haven't tried, I haven't tested it against non-Svelte
plasmo uses lightningcss underneath so CSS compiling issue is due to that package
What I know so far is that even if I don't use SCSS, the issue persists
I see, then we should perhaps report the issue there
The issue persists whether the
<style>
has or doesn't have lang="scss"
What do we do in the meantime?
What is the easiest way to run lightningcss
?
I tried running through the browser, didn't work
I tried running it through Node.js, couldn't reproduce
I tried running it through the CLI, couldn't I'm not quite sure tbh xD......
what if you use a separate css file?
does it work or still foobar xd
Interesting,
+
is also affected
It has something to do with :placeholder-shown
Probably this one https://github.com/parcel-bundler/lightningcss/blob/30469232c3fdb828753db4be49f48e9bf727a655/src/selector.rs#L131
For some reason, if the selectors are nested, it will change :placeholder-shown
into :-moz-placeholder-shown
, e.g.
Maybe it has to do with the Svelte compiler
@louis Seems like I'm able to trick the compiler with
In this case, it'll produce both versions
WTF, despite the CSS looking right, the rules aren't being applied ๐fascinating lol
I ran into a stupid issue ๐
๐คจ
position - CSS: Cascading Style Sheets | MDN
The position CSS property sets how an element is positioned in a document. The top, right, bottom, and left properties determine the final location of positioned elements.
Why dafuq is the initial value
static
???lol it's always has been
It's so weird
On the left it's the popup, on the right it's Codepen
And as I said before, the rules should be applied
wait fr
I removed the
:not(:-moz-placeholder-shown)
and it workedheh
Yeah, the CSS engine apparently doesn't like unknown pseudo classes
And yes, it doesn't exist
should be fast I hope, it's a pretty active project
TBH I'm not even sure if my PR will solve the issue ๐
It's been 4 days since the PR
me when I submit a PR to parcel and they took 3 months to merge it, which prompted me to create the plasmo framework
(fyi lightningcss was created and maintained by the same guy working on parcel)
oh yeah they added it to the parcel project now eh I forgot about ixd
The thing is, I don't even know if my fix will indeed fix me problem
I thought it was a big brain moment, but
lightningcss
was like
@louis I'm wondering, why does
data-text:
involve lightningcss
at all? I mean, I intend to import textit still need to transform the css/sass into optimized code within the bundle :d
I see, IMO it should be context-dependent
I.e. importing SCSS should indeed be processed and optimized, but if I import CSS this way while in a Svelte/Vue popup, I'd probably want to deal with the CSS myself, such as working around the annoying
-moz-placeholder-shown
thing
You know what, how about if you fork the repo and apply my PR until a Parcel maintainer will merge it?hmmm... tempting
one problem I hate about the parcel repo is that
it's big xD...
I was never able to build the whole thing from source, and lightningcss is rust based too xd
I think it's worth the shot
oh actually seems like lightningcss is separated into its own repo now
just under the same org
Relying on an unmaintained project is hell
lol
well yeah but nobody thank him
try build and publish to npm on your end, and I can guide you on how to use it in your local plasmo to test and debug further
actually build and link it :p
easiest for you to do is build, link your local lightningcss build with your extension <- pnpm will resolve to your local build
then you can verify if that PR fix the issue you saw
man sounds like too much work ๐
@louis This is what I call a big brain move
lol got 'em
Screw you
lightningcss
๐@louis Someone responded