cssinjs / css-vendor

Runtime vendor prefixing based on feature detection.
MIT License
67 stars 24 forks source link

Fix writing-mode for Chrome/any WebKit except Safari #29

Closed AleshaOleg closed 7 years ago

AleshaOleg commented 7 years ago

This one need to be checked because only Safari, should be prefixed.

kof commented 7 years ago

Can we feature test that somehow?

AleshaOleg commented 7 years ago

@kof i will fix tests firstly today. What you mean about "feature test" in this case?

kof commented 7 years ago

Feature test is a test that allows to detect support of a certain feature without sniffing on agent name.

AleshaOleg commented 7 years ago

@kod idk, detecting agent name is only way i know how to fix that. Because, even Chrome need to be prefixed on 47 version and less. As well as old Android Browser.

kof commented 7 years ago

What if we use https://developer.mozilla.org/en-US/docs/Web/API/CSS/supports where it is supported and prefix all others?

kof commented 7 years ago

It seems to be wildly implemented: https://caniuse.com/#feat=css-featurequeries

AleshaOleg commented 7 years ago

no support for IE:( It's actually Candidate Recommendation

kof commented 7 years ago

yes, but IE has no writing-mode support either, right?

AleshaOleg commented 7 years ago

partial support, as i understood.

kof commented 7 years ago

Another option: render some text and check if writing mode was correctly applied. Do it once and cache the result.

AleshaOleg commented 7 years ago

will it cause any UI problems? Why you don't like check simply check browser version?

kof commented 7 years ago

will it cause any UI problems?

No if you don't render it in a visible way.

Why you don't like check simply check browser version?

Browser version checks are fragile, we can't test in every possible browser version and we don't know if there are problems with future versions.

Browser sniffing is the worst thing you can do, always avoid if possible

AleshaOleg commented 7 years ago

ok, will try implement render some text later today.

kof commented 7 years ago

Also you can try CSS.supports, if there is no implementation, try render test.

AleshaOleg commented 7 years ago

CSS.supports('writing-mode', 'initial') for Safari 11, returns true. But it should be prefixed. So CSS.supports will not help us to detect if value should be prefixed.

kof commented 7 years ago

I see, it returns true even if the property is supported behind the vendor prefix.

AleshaOleg commented 7 years ago

Could you explain how you wanna check if property is applied correctly to element?

AleshaOleg commented 7 years ago

Hm, I have an idea. What if we usually will add three properties? Like:

-webkit-writing-mode: initial;
-ms-writing-mode: initial;
writing-mode: initial;
kof commented 7 years ago

we can't do that, API expects us to return one property. Also this is something user can easily do as well.

AleshaOleg commented 7 years ago

It seems, like Safari 11 should not be prefixed as we expected. I created issue, to fix this on caniuse website

https://github.com/Fyrd/caniuse/issues/3794

kof commented 7 years ago

merged