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

If IE8 only, why not using -ms-filter than? #2

Closed
Volker-E opened this issue Feb 25, 2015 · 5 comments
Closed

If IE8 only, why not using -ms-filter than? #2

Volker-E opened this issue Feb 25, 2015 · 5 comments

Comments

@Volker-E
Copy link

Would help validation of the output stylesheet! See for example: http://css-tricks.com/css-transparency-settings-for-all-broswers/

@iamvdo
Copy link
Owner

iamvdo commented Feb 25, 2015

Not IE8 only, but IE8- (even if IE9 will also understand it).
The recommended syntax is not using the -ms-filter: https://developer.mozilla.org/en-US/docs/Web/CSS/opacity#Different_opacity_with_.3Ahover

Maybe we should add an option for IE7 to get zoom: 1 ?

Would help validation of the output stylesheet

What do you mean ?

@iamvdo iamvdo closed this as completed Feb 25, 2015
@Volker-E
Copy link
Author

@iamvdo Actually, just because it's in MDN, it doesn't mean, it's solid gold ;)
I thought about correcting the article after coming across the non-optimal syntax.

The sense in using the -ms-filter syntax (and also reason for Microsoft in their approach towards better standards-support of IE 8) is to have a valid stylesheet in the end.

So if you're going for an option, an option for IE8 only usage or IE8/IE7 mixed usage or IE8 and all lower would be the right approach IMHO.
As many devs start with HTML5BoilerPlate as their foundation, they also come across root classes for IE, like .ie8, .ie7 and so on. So they won't even wanna use this package, as they prefer to use f.e. Sass mixins or extends to include special classes for IE.

I see the real sense here in flexibility in output and mostly for devs, who still wanna support IE8.

@iamvdo
Copy link
Owner

iamvdo commented Feb 25, 2015

just because it's in MDN, it doesn't mean, it's solid gold ;)

Same goes for CSS Tricks. ;)

The sense in using the -ms-filter syntax is to have a valid stylesheet in the end.

It's the opposite, right ? Using prefixes make stylesheets invalid.

BTW, I've to admit I don't know what to do: filter works IE8- and -ms-filter works only IE8. If you target IE8, this works in all cases, and you don't care if it applies to older browsers, so what's the point ?

The simplest thing is maybe to use -ms-filter by default (IE8), and add an option to support older browsers which will also add filter and zoom. What do you think about that ?

/cc @7studio (Ref: iamvdo/pleeease#16)

@Volker-E
Copy link
Author

Volker-E commented Mar 8, 2015

No, vendor-prefixed properties are specified in CSS 2.1.
See this for further clarification: https://stackoverflow.com/questions/6900647/ms-filter-vs-filter-whats-the-difference

And yes, your suggestion would be a great default output. :)

@7studio
Copy link

7studio commented Mar 10, 2015

Hi,
I find this issue really interesting even if it seems to be a detail at first :-)
Up to now, I didn't care about this particular point (it's still the case) but the @Volker-E issue seems legitimate.
IMHO, it is more than a validation or a IE version case.

Take the example below:

/* in.css */
img {
    filter: invert(100%);
    opacity: .5;
}

/* out.css (with postcss-opacity) */
img {
    filter: invert(100%);
    opacity: .5;
    filter: alpha(opacity=50);
}

While someone identifies the second filter property like a hack for old IE (as it is), someone else could think that it's an override of the first one for a test, a wrong declaration or anything else.
Even if we should not read the output (especially when you are using a processor or a formatter), you are able to see these declarations in some dev tools (e.g.: Chrome and IE).
And without any comment or a ref to the source file, it could be disturbing.

In fact, the syntax filter: alpha(opacity=xx) is maybe a bad way with recent browsers and CSS3 too. The value alpha(opacity=50) is now parsed as an illegal value for the CSS3 filter property
whereas -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=50)" is just ignored.

IMHO, we should use -ms-filter instead of filter for two reasons:

  1. The property name is clearer in all the situations (output, dev tools) and won't interact with the CSS3 spec.
  2. The plugin description is "PostCSS plugin to add opacity filter for IE8.", so targeting only IE8 is more correct.
  3. CSSLint (and other linters) will stop to warn the message "duplicate property …"

BTW, the plugin should not care about IE versions lower than 8 ^^

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

No branches or pull requests

3 participants