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

Issue with media queries in CSS #4

Open
andru opened this issue Oct 14, 2014 · 0 comments
Open

Issue with media queries in CSS #4

andru opened this issue Oct 14, 2014 · 0 comments
Labels

Comments

@andru
Copy link
Contributor

andru commented Oct 14, 2014

Reported by Daniel....

I had to comment out a few lines of core MediaWiki code to get
bootstrap to work with IE, even IE 11. It appears that ResourceLoader
does some strange stuff, and I am not sure if this is a bug in
Skinny/Booty or just a bad idea in the way the MediaWiki devs are
handling CSS resources.

Here, in a nutshell, is the issue.

ResourceLoader.php has a function called makeCombinedStyles() that
merges CSS files into one big glob. And if the CSS file are intended
for "screen" display, it wraps all of the CSS definitions in a media
query, like this:

"@media screen {" + all_my_css +"}"

For most browsers, this is not a problem. However, IE, even the most
recent versions of IE, do not support nested media queries, so this
doesn't work:

"@media screen { @media foo { } }"

So, if your CSS already has media queries in it, then the act of
makeCombinedStyles() wrapping the CSS in a media query actually breaks
the CSS for all versions of IE, because it turns all of bootstrap's
intentionally non-nested media queries into nested media queries,
which IE then ignores.

There are some workarounds:

  1. Make sure the CSS resource has a media value of '' or 'all' -- that
    way, it is not wrapped in a media query when makeCombinedStyles() is
    called.
  2. Comment out the core MediaWiki CSS code that wraps 'screen'
    resources in a media query.

I am not sure what the "right" solution is. If we should expect
ResourceLoader.php to be able to serve arbitrary CSS and have it work
in all browsers, then it is simply not okay to wrap the CSS in a media
query.

If the current MediaWiki behavior is the "correct" behavior, then any
CSS marked for "screen" display must not have embedded media queries,
or it will end up broken for all IE users.

I am not sure if this is a MediaWiki bug/oversight or a Booty/Skinny
bug, so I wanted to get your opinion on it.

@andru andru added the bug label Oct 14, 2014
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

1 participant