Skip to content
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

Using @container query logs error #3597

Open
zbigg opened this issue Sep 14, 2023 · 15 comments · May be fixed by #3707
Open

Using @container query logs error #3597

zbigg opened this issue Sep 14, 2023 · 15 comments · May be fixed by #3707

Comments

@zbigg
Copy link

zbigg commented Sep 14, 2023

Basic info:

  • Node.js version: v20.6.1
  • jsdom version: 22.1.0

Minimal reproduction case

const { JSDOM } = require('jsdom');

new JSDOM(`
  <style>
    @container (min-width: 700px) {
      .card h2 {
        font-size: 2em;
      }
    }
  </style>
`);

The container query is taken from MDN documentation in this feature, so it should be correct (?)

Sorry if there is duplicate already, but brief search was unsuccessfull.

How does similar code behave in browsers?

Works as expected - container query has effect on style applied to elements.

@zbigg
Copy link
Author

zbigg commented Sep 14, 2023

Looks like this is implemented by cssom and there is open issue there: NV/CSSOM#109 and not being tackled rrweb-ccsom used currently by jsdom.

@domenic
Copy link
Member

domenic commented Sep 14, 2023

I don't think this is implemented by cssom? We switched to rrweb-cssom because cssom was not maintained.

@zbigg
Copy link
Author

zbigg commented Sep 14, 2023

And sorry for wrong title (fixed now), it just reports error on virtual console and classic workaround of providing custom virtual console (possibly silent) helps with at least ignoring this error:

new jsdom.JSDOM('',
  { virtualConsole: new jsdom.VirtualConsole() }
)

@zbigg zbigg changed the title Using @container query throws Using @container query logs error Sep 14, 2023
@hoepfnerdennis
Copy link

There is the same error log when using @layer...

const { JSDOM } = require('jsdom');

new JSDOM(`
  <style>
    @layer {
      .card h2 {
        font-size: 2em;
      }
    }
  </style>
`);

@dustindowns
Copy link

Getting the same @layer error too when attempting to test with PrimeVue components.

Screenshot 2023-10-13 at 2 16 04 PM

@The-Real-1
Copy link

The-Real-1 commented Dec 7, 2023

Hi everyone,

We are also facing the same problem when having @layer specified in our Css files.
We looked up the source code of CSSOM and the problem is inside the parser() method. The code does not handle correctly some attibutes starting with an @.
We also noticed that this library is no longer maintained by the author . You can see here the repository : CSSOM Repository .

The last version (0.5.0) is now two yeard old and maybe it's time to move on.
Finding an alternative and remove CSSOM from JSDOM dependencies will be great if not too costy for the team.

@viceice
Copy link

viceice commented Dec 22, 2023

any known workaround for jest jsdom? I'm facing the issue with primeng and @layer.

@cluxig
Copy link

cluxig commented Jan 18, 2024

Same for me. Unable to test primeng properly.

@SergioCanalejo
Copy link

Any update or workaround about that? I've been stuck in a old primevue version because of that

@romain-blatrix
Copy link

I made a fork where I added support for @container : https://github.com/mirakl/cssom

@jantimon
Copy link

jantimon commented May 2, 2024

in the meantime @domenic and @seanparmelee switched from cssom 0.5.0 to rrweb-cssom 0.6.0 in #3497
rrweb-cssom is maintained by @YunFeng0817 npm/fitz5264

so I moved the @container fix by @romain-blatrix there: rrweb-io/CSSOM#2

Unmaintained Warning

lets hope for the best

@alopix
Copy link

alopix commented May 2, 2024

It has already been merged. Now to hope for a new version being released someday.

@YunFeng0817
Copy link

Hi jsdom team, v0.7.0 has been published!

@jantimon jantimon linked a pull request May 2, 2024 that will close this issue
@jantimon
Copy link

jantimon commented May 2, 2024

thanks @YunFeng0817

I created a pr to bump the version:

#3707

@jantimon
Copy link

finally the pipeline is green 🎉

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

Successfully merging a pull request may close this issue.