Problem/Motivation
Webkit and many other browsers grow up so fast. Many of them support native CSS3 syntax, without the need of vendor-prefix. We use autoprefixer as a tool to remove them from core. (also, adding back the required -prefix)
Autoprefixer Command:
autoprefixer -b "last 2 versions, ie 9, Android >= 4" `git ls-files "*.css" | grep -E -v
'(.*/vendor|core/tests)'`
Target Browsers:
IE: 11, 10, 9
Firefox: 31, 30
Chrome: 37, 36
Safari: 7, 6.1
Opera: 23, 22
iOS: 7.1, 7.0
Android: 4.4, 4.3, 4.2, 4.1, 4
IE Mobile: 10
** Notes: to maximize the support, I also ran a command includes Safari 5.1 & iOS 6 to compare the differences. Thankful, it has given same results :)
Original report by @droplet
Webkit and many other browsers grow up so fast. Many of them support native CSS3 syntax, without the need of vendor-prefix. Let's find out what vendor prefixes we can remove from core.
Prefixes that have been removed (in the patches below):
-webkit-box-sizing
(#23)
Prefixes to remove (not yet in the patches below):
-moz-box-sizing
(In #2124251, we're trying to add this globally).-o-box-sizing
-moz-box-shadow
-moz-border-radius
Comment | File | Size | Author |
---|---|---|---|
#51 | autoprefixer-51.patch | 38.33 KB | droplet |
#40 | autoprefixer-40.patch | 37.32 KB | droplet |
#40 | interdiff.patch | 1.84 KB | droplet |
#34 | autoprefixer-34.patch | 37.31 KB | droplet |
#30 | interdiff.txt | 396 bytes | G-raph |
Comments
Comment #1
aspilicious CreditAttribution: aspilicious commented- we can't remove webkit box sizing yet, it's not available in latests safari.
- we can remove webkit-boxshadow
- we can't remove gradient stuff
So in the end it's only one or two lines that need to go
Comment #2
droplet CreditAttribution: droplet commentedSafe:
http://caniuse.com/#search=box-sizing
Not Safe:
http://caniuse.com/#search=box-shadow
Comment #3
aspilicious CreditAttribution: aspilicious commentedI'm confused so apparantly we can remove -webkit-box-sizing to.
Whats wrong with -webkit-box shadow?
Comment #4
aspilicious CreditAttribution: aspilicious commentedOw I see its needed for mobile devices...
And box sizing to for lots of mobile phones.
Mmmm
Comment #4.0
aspilicious CreditAttribution: aspilicious commentedUpdated issue summary.
Comment #5
csakiistvanDrop from where? I found a lot (hundreds) in ckeditor css files, and a lot in modules css files.
Comment #6
csakiistvanComment #7
droplet CreditAttribution: droplet commentednever touch 3rd parties files :)
Comment #8
csakiistvanOk, thx :)
Comment #9
csakiistvanComment #15
csakiistvanI don't understand...
Comment #16
droplet CreditAttribution: droplet commentedold source ? it couldn't apply:
Output: [error: patch failed: core/themes/seven/css/style.css:833
Comment #17
csakiistvanComment #18
csakiistvanComment #19
sqndr CreditAttribution: sqndr commentedThe wrong thing was changed here.
Comment #20
sqndr CreditAttribution: sqndr commentedComment #21
sqndr CreditAttribution: sqndr commentedComment #22
G-raph CreditAttribution: G-raph commentedGonna fix this one.
Comment #23
G-raph CreditAttribution: G-raph commentedI replaced the "-webkit-box-sizing: border-box;" with "-moz-box-sizing: border-box;" on rule 113.
Comment #24
sqndr CreditAttribution: sqndr commentedThanks for fixing this G-raph!
Need some opinions now: are we removing other prefixes as well - or would this be it?
Comment #25
droplet CreditAttribution: droplet commented@sqndr,
removing other prefixes as well.
from my own views:
- box-sizing
- box-shadow
- border-radius
..
Comment #26
rteijeiro CreditAttribution: rteijeiro commentedAfter discussion with @lewisnyman we decided that we can get rid of the following prefixes too:
-moz-box-sizing
-moz-box-shadow
-moz-border-radius
Comment #27
G-raph CreditAttribution: G-raph commentedComment #28
G-raph CreditAttribution: G-raph commentedI removed all -moz-box-sizing, -moz-box-shadow, -moz-border-radius from core. This was asked in #26.
Comment #29
sqndr CreditAttribution: sqndr commentedThis should be removed as well.
Comment #30
G-raph CreditAttribution: G-raph commentedFixed #29!
Comment #31
rteijeiro CreditAttribution: rteijeiro commentedComment #32
droplet CreditAttribution: droplet commentedthe big list output from autoprefixer
quick n dirty config:
Comment #33
joelpittet@droplet that script is awesome, it would be so awesome if that was just as a kind of lint test on CSS patches. Maybe something to discuss with some of the pifr maintainers?
I don't usually use autoprefixer and was reviewing the patch it helped create. Why does it add a -moz-box-sizing prefix?
@see http://caniuse.com/#feat=css3-boxsizing
It seems that -moz is the only one that has full support. Maybe I'm reading this wrong? Also the issue summary says we are to get rid of it. If so can auto-prefixer be configured to stop prefixing -moz-box-sizing?
I love when prefixes go a way, but I think we need to scrutinize them being added as much as possible! There are likely a few more that should be configured out if possible but that one stood out to me.
Nice work getting the computer to do the work!:)
Comment #34
droplet CreditAttribution: droplet commented@joelpittet,
ahh right, I missed it.
'> 5%', 'last 2 versions', 'ie 9'
- IE9+
- last 2 versions targets the last 2 versions for each browser..
- > 5% declares browser versions selected by global usage statistics. ( 1% ~ 5%, no changes in Drupal Core)
Overview: (this patch only)
Removed:
-moz-box-sizing
-webkit-box-sizing
-moz-linear-gradient
-o-linear-gradient
-moz-transition
-ms-transition
-o-transition
-moz-transform
-moz-backface-visibility
-moz-keyframes
-o-keyframes
Added:
-webkit-linear-gradient ( for Andriod 4.3 )
-ms-hyphens ( for IE 10+ )
-ms-transform ( for IE 9 )
Comment #35
joelpittetNo worries @droplet the method is WAY more important than the solution:)
Here's my notes on all the additions:
All the duplicates we can fix manually I'm sure that's just a parsing error, maybe something to note upstream to the autoprefixer peoples?
Duplicate
Duplicate
Does safari need -webkit?
http://caniuse.com/#feat=transforms2d
Are we targeting Safari?
Duplicate but to bottom became "top".
Is this needed? http://caniuse.com/#feat=css-transitions
IE9 is falling back to no transition though I'm sure that is fine just wanted to mention. If someone thinks different, separate issue.
Looking better yet! Nice job @droplet!
Comment #36
joelpittetMaybe safari fell through the cracks on that >5%? Though these stats have it at just above 10%. Likely due to ios devices.
http://gs.statcounter.com/
Comment #37
droplet CreditAttribution: droplet commented#1
#2
Yes, seems like some parser errors.
#3:
it has -webkit-prefix already. Yes. Safari is required
#4:
this is Syntax error, no "to bottom" in -webkit-prefix / -moz-prefix
#5,
Android 4.x is required. About 50% of Android market share:
https://developer.android.com/about/dashboards/index.html?utm_source=aus...
( Many popular Android devices do not have a chance to upgrade it, eg. Galaxy S3. )
iOS Safari & Desktop Safari count as two different browser in autoprefixer (caniuse.com)
I have compared 1% & 5%, also 'Safari 6+'. no difference results.
Comment #38
sqndr CreditAttribution: sqndr commentedUpdating the Issue summary and adding a related node (box-sizing).
Comment #39
sqndr CreditAttribution: sqndr commentedTurns out there was another issue: #2005520: Remove remaining prefixed border-radius and box-shadow from core. I closed that one, because the latest patch was from a year ago and all of the css files have moved. Let's fix the vendor prefixes in this issue.
Comment #40
droplet CreditAttribution: droplet commentedaddress the problem mentioned in #35.
Here are removing the old & incorrect -webkit-linear-gradient.
Comment #42
joelpittetThanks for addressing my concerns about the additional prefixed items and super happy to see the the removals.
Nice diff stats: 28 files changed, 21 insertions, 196 deletions.
The additions as mentioned in #37 are to help older Android devices.
And the gulp script in #32 is brilliant.
@droplet could you add the latest gulp script you are using to the Issue Summary with any Caveats/work arounds you needed after it was run? That way we can reference this if we need to update it or if someone comes up with a pifr service to apply it/test against it.
Comment #43
droplet CreditAttribution: droplet commentedComment #44
droplet CreditAttribution: droplet commentedComment #45
nod_That looks a lot like a list of browser support. I'll just copy this list in #1030090: Document our browser support list for reference.
Comment #47
joelpittetNonsense testbot! Shenanigans!
Comment #50
joelpittet@droplet mind running that again? I'll re-RTBC it. Seven moved all it's files into different folders recently.
Comment #51
droplet CreditAttribution: droplet commentedNo interdiff provided because it looks so messed after folders rerolls.
Comment #52
joelpittetRead through it again, looks good, back to RTBC. Thanks @droplet
Comment #53
alexpottThe automated tool seems to not obey our standards. Committed d7d2d75 and pushed to 8.0.x. Thanks!
Fixed spacing issues on commit.