NV / CSSOM

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

Can't parse @font-face nested in @media. #102

Closed jonkemp closed 4 years ago

jonkemp commented 4 years ago

Breaks on code like this.

@media screen {
    a {
        color: blue !important;
        background: red;
    }
    @font-face {
        font-family: 'Arial2';
    }
}
NV commented 4 years ago

I unrolled this because it broke nested media queries #104.

https://github.com/NV/CSSOM/blob/a4b46da3a2f3eeeca488f098aaedee2a02825e86/lib/parse.js#L389-L415 This logic looks rather complex. I'm not going to attempt to fix it right now.

I'll still accept a patch that handles both nested media queries and @font-face rules inside of media queries.

NV commented 4 years ago

@devrelm since you implemented nested media rules, perhaps you know how to fix parsing of @font-face nested in @media properly.

jonkemp commented 4 years ago

@NV thanks for fixing!