NV / CSSOM

Unmaintained! ⚠️ CSS Object Model implemented in pure JavaScript. Also, a CSS parser.
https://nv.github.io/CSSOM/docs/parse.html
MIT License
752 stars 99 forks source link

Nested media queries #104

Closed dyatko closed 4 years ago

dyatko commented 4 years ago

I'm running tests using latest jest and jsdom fails due to "Could not parse CSS stylesheet"

jest: 24.9.0
jsdom: 15.2.1
cssom: 0.4.2

The issue is with inherited media queries which work perfectly in Chrome.

@media (min-width: 768px) {
  h1 {
    color: red;
  }

  @media (min-resolution: 0.001dpcm) {
    h1 {
      color: yellow;
    }

    @supports (-webkit-appearance: none) {
      h1 {
        color: green;
      }
    }
  }
}

@media (min-resolution: 0.001dpcm) {
  a {
    color: green;
  }
}

@supports (-webkit-appearance: none) {
  p {
    color: blue;
  }
}
<h1>Hello!</h1>
<p>
  Inherited media queries <a href="#">here</a>.
</p>
dyatko commented 4 years ago

Might be related to #103

dyatko commented 4 years ago

And also https://github.com/NV/CSSOM/issues/1#issuecomment-55845103

NV commented 4 years ago

I unrolled the regression. Thank you for reporting.