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

css-mediaquery does not work with comments in media queries and with Opera's device pixel ratio #7

Open
rvock opened this issue Feb 3, 2014 · 4 comments
Labels

Comments

@rvock
Copy link

rvock commented Feb 3, 2014

Two samples which fail to parse:

@media (-o-min-device-pixel-ratio: 3 / 2) {
    body { background: url('hd-background.png'); }
}
@media (-webkit-min-device-pixel-ratio: 1.5),
    (min--moz-device-pixel-ratio: 1.5),
    /* Opera Device Pixel ratio not supported by css-mediaquery 0.1.2 */
    /* (-o-min-device-pixel-ratio: 3 / 2), */
    (min-device-pixel-ratio: 1.5) {
    body { background: url('hd-background.png'); }
}

This works:

@media (min-device-pixel-ratio: 1.5) {
    body { background: url('hd-background.png'); }
}
@ericf
Copy link
Owner

ericf commented Feb 4, 2014

I'll work on doing the pragmatically-correct thing for these. I held off on adding support for vendor prefixes, because the best practice is to include a non-prefix query in the set, like you have in the second example.

I will add support for comments, since those are a valid part of the spec.

@maltewassermann
Copy link

Support for vendor prefixes:
-webkit-…
-o-…
…-moz-…

Usage:
Compare it with a non-prefix query…

Changes (@ericf please revisit):
https://github.com/ericf/css-mediaquery/blob/master/index.js#L16

RE_MQ_FEATURE      = /^(?:-(webkit|moz|o)-)?(?:(min|max)-)?(?:-(moz)-)?(.+)/,

https://github.com/ericf/css-mediaquery/blob/master/index.js#L131-L132

modifier: feature[2],
feature: feature[4],

@mahnunchik
Copy link

+1

@mahnunchik
Copy link

Any news?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants