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

(http://drupal.org/node/1651270#comment-6172636)

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

aspilicious’s picture

- 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

droplet’s picture

aspilicious’s picture

I'm confused so apparantly we can remove -webkit-box-sizing to.
Whats wrong with -webkit-box shadow?

aspilicious’s picture

Ow I see its needed for mobile devices...
And box sizing to for lots of mobile phones.
Mmmm

aspilicious’s picture

Issue summary: View changes

Updated issue summary.

csakiistvan’s picture

Issue summary: View changes

Drop from where? I found a lot (hundreds) in ckeditor css files, and a lot in modules css files.

csakiistvan’s picture

Status: Active » Postponed (maintainer needs more info)
droplet’s picture

Status: Postponed (maintainer needs more info) » Active

never touch 3rd parties files :)

csakiistvan’s picture

Ok, thx :)

csakiistvan’s picture

Status: Active » Needs review
FileSize
8.66 KB

Status: Needs review » Needs work

The last submitted patch, 9: 1664268_drop_some_webkit_prefix_9.patch, failed testing.

Status: Needs work » Needs review

Status: Needs review » Needs work

The last submitted patch, 9: 1664268_drop_some_webkit_prefix_9.patch, failed testing.

Status: Needs work » Needs review

Status: Needs review » Needs work

The last submitted patch, 9: 1664268_drop_some_webkit_prefix_9.patch, failed testing.

csakiistvan’s picture

I don't understand...

droplet’s picture

old source ? it couldn't apply:
Output: [error: patch failed: core/themes/seven/css/style.css:833

csakiistvan’s picture

FileSize
9.08 KB
csakiistvan’s picture

Status: Needs work » Needs review
sqndr’s picture

Status: Needs review » Needs work
+++ b/core/modules/quickedit/css/quickedit.theme.css
@@ -110,7 +110,6 @@
-  -moz-box-sizing: border-box;
   -webkit-box-sizing: border-box;

The wrong thing was changed here.

sqndr’s picture

Issue summary: View changes
sqndr’s picture

Issue summary: View changes
G-raph’s picture

Assigned: Unassigned » G-raph
Issue summary: View changes
Issue tags: +FUDK

Gonna fix this one.

G-raph’s picture

Assigned: G-raph » Unassigned
Status: Needs work » Needs review
FileSize
596 bytes
9.04 KB

I replaced the "-webkit-box-sizing: border-box;" with "-moz-box-sizing: border-box;" on rule 113.

sqndr’s picture

Issue summary: View changes

Thanks for fixing this G-raph!

Need some opinions now: are we removing other prefixes as well - or would this be it?

droplet’s picture

@sqndr,

removing other prefixes as well.

from my own views:

- box-sizing
- box-shadow
- border-radius
..

rteijeiro’s picture

Title: Drop some -webkit prefix » Drop some browser specific prefixes
Issue summary: View changes
Status: Needs review » Needs work

After discussion with @lewisnyman we decided that we can get rid of the following prefixes too:

-moz-box-sizing
-moz-box-shadow
-moz-border-radius

G-raph’s picture

Assigned: Unassigned » G-raph
G-raph’s picture

Assigned: G-raph » Unassigned
Status: Needs work » Needs review
FileSize
10.22 KB
9.22 KB

I removed all -moz-box-sizing, -moz-box-shadow, -moz-border-radius from core. This was asked in #26.

sqndr’s picture

+++ b/core/modules/toolbar/css/toolbar.module.css
@@ -7,9 +7,7 @@
   -o-box-sizing: border-box;

This should be removed as well.

G-raph’s picture

Fixed #29!

rteijeiro’s picture

Issue summary: View changes
Issue tags: +CSS, +CSS novice, +Novice, +frontend
droplet’s picture

FileSize
36.7 KB

the big list output from autoprefixer

quick n dirty config:

var gulp = require('gulp');
var prefix = require('gulp-autoprefixer');

gulp.task('default', function () {
  return gulp.src('core/{config,includes,lib,misc,modules,profiles,scripts,themes}/**/*.css')
    .pipe(prefix('> 1%', 'last 2 versions', 'Firefox ESR', 'Opera 12.1', 'ie 9'))
    .pipe(gulp.dest('./core'));
});
joelpittet’s picture

Status: Needs review » Needs work

@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!:)

droplet’s picture

Status: Needs work » Needs review
FileSize
37.31 KB

@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 )

joelpittet’s picture

Status: Needs review » Needs work

No 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?

  1. +++ b/core/modules/contextual/css/contextual.theme.css
    @@ -109,5 +109,6 @@
       background-image: -webkit-linear-gradient(rgb(78,159,234) 0%,rgb(65,126,210) 100%);
    +  background-image: -webkit-linear-gradient(rgb(78,159,234) 0%, rgb(65,126,210) 100%);
    

    Duplicate

  2. +++ b/core/modules/contextual/css/contextual.toolbar.css
    @@ -20,9 +20,9 @@
       background-image: -webkit-linear-gradient(top,  rgb(78,159,234) 0%, rgb(69,132,221) 100%);
    +  background-image:-webkit-linear-gradient(rgb(78,159,234) 0%, rgb(69,132,221) 100%);
    

    Duplicate

  3. +++ b/core/modules/quickedit/css/quickedit.theme.css
    @@ -130,9 +126,9 @@
    -  transform: rotate(45deg);
    +  -ms-transform: rotate(45deg);
    +      transform: rotate(45deg);
    

    Does safari need -webkit?
    http://caniuse.com/#feat=transforms2d

    Are we targeting Safari?

  4. +++ b/core/themes/bartik/css/colors.css
    @@ -21,11 +21,9 @@ body {
       background-image: -webkit-linear-gradient(to bottom, #055a8e 0%, #1d84c3 100%);
    +  background-image: -webkit-linear-gradient(top, #055a8e 0%, #1d84c3 100%);
    

    Duplicate but to bottom became "top".

  5. +++ b/core/themes/seven/css/style.css
    @@ -587,7 +581,8 @@ th > a:after {
    -  transition: all 0.1s;
    +  -webkit-transition: all 0.1s;
    +          transition: all 0.1s;
    
    @@ -901,7 +893,8 @@ textarea.form-textarea {
         font-size: 0.875rem;
    -    transition: all 0.1s;
    +    -webkit-transition: all 0.1s;
    +            transition: all 0.1s;
    

    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!

joelpittet’s picture

Maybe 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/

droplet’s picture

#1
#2
Yes, seems like some parser errors.

#3:

+++ b/core/modules/quickedit/css/quickedit.theme.css
@@ -130,9 +126,9 @@
   -webkit-transform: rotate(45deg);

it has -webkit-prefix already. Yes. Safari is required

#4:

   background-image: -webkit-linear-gradient(to bottom, #055a8e 0%, #1d84c3 100%);

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. )

Maybe 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/

iOS Safari & Desktop Safari count as two different browser in autoprefixer (caniuse.com)

I have compared 1% & 5%, also 'Safari 6+'. no difference results.

sqndr’s picture

Updating the Issue summary and adding a related node (box-sizing).

sqndr’s picture

Turns 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.

droplet’s picture

Status: Needs work » Needs review
FileSize
1.84 KB
37.32 KB

address the problem mentioned in #35.

Here are removing the old & incorrect -webkit-linear-gradient.

The last submitted patch, 40: interdiff.patch, failed testing.

joelpittet’s picture

Status: Needs review » Reviewed & tested by the community

Thanks 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.

droplet’s picture

Issue summary: View changes
droplet’s picture

Issue summary: View changes
nod_’s picture

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.

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 40: autoprefixer-40.patch, failed testing.

joelpittet’s picture

Status: Needs work » Reviewed & tested by the community

Nonsense testbot! Shenanigans!

alexpott queued 40: autoprefixer-40.patch for re-testing.

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 40: autoprefixer-40.patch, failed testing.

joelpittet’s picture

Issue tags: +Needs reroll

@droplet mind running that again? I'll re-RTBC it. Seven moved all it's files into different folders recently.

droplet’s picture

Status: Needs work » Needs review
FileSize
38.33 KB

No interdiff provided because it looks so messed after folders rerolls.

joelpittet’s picture

Status: Needs review » Reviewed & tested by the community
Issue tags: -Needs reroll

Read through it again, looks good, back to RTBC. Thanks @droplet

alexpott’s picture

Status: Reviewed & tested by the community » Fixed

The automated tool seems to not obey our standards. Committed d7d2d75 and pushed to 8.0.x. Thanks!

diff --git a/core/modules/locale/css/locale.admin.css b/core/modules/locale/css/locale.admin.css
index c8b1aec..5ab9748 100644
--- a/core/modules/locale/css/locale.admin.css
+++ b/core/modules/locale/css/locale.admin.css
@@ -109,7 +109,7 @@
   -webkit-hyphens: auto;
   -moz-hyphens: auto;
   -ms-hyphens: auto;
-      hyphens: auto;
+  hyphens: auto;
 }
 .js #locale-translation-status-form .description .inner {
   height: 20px;
diff --git a/core/modules/quickedit/css/quickedit.theme.css b/core/modules/quickedit/css/quickedit.theme.css
index 082a7a5..8d9e198 100644
--- a/core/modules/quickedit/css/quickedit.theme.css
+++ b/core/modules/quickedit/css/quickedit.theme.css
@@ -128,7 +128,7 @@
   position: absolute;
   -webkit-transform: rotate(45deg);
   -ms-transform: rotate(45deg);
-      transform: rotate(45deg);
+  transform: rotate(45deg);
   width: 16px;
   z-index: 1;
 }
diff --git a/core/modules/system/css/system.admin.css b/core/modules/system/css/system.admin.css
index 60ba759..8e37997 100644
--- a/core/modules/system/css/system.admin.css
+++ b/core/modules/system/css/system.admin.css
@@ -84,7 +84,7 @@ small .admin-link:after {
   -webkit-hyphens: auto;
   -moz-hyphens: auto;
   -ms-hyphens: auto;
-      hyphens: auto;
+  hyphens: auto;
   text-transform: none;
 }
 #system-modules td details a {
diff --git a/core/themes/seven/css/components/form.css b/core/themes/seven/css/components/form.css
index f079e82..3ed3490 100644
--- a/core/themes/seven/css/components/form.css
+++ b/core/themes/seven/css/components/form.css
@@ -203,7 +203,7 @@ textarea.form-textarea {
     text-shadow: 0 1px hsla(0, 0%, 100%, 0.6);
     font-size: 0.875rem;
     -webkit-transition: all 0.1s;
-            transition: all 0.1s;
+    transition: all 0.1s;
     -webkit-font-smoothing: antialiased;
   }
   [dir="rtl"] select {
diff --git a/core/themes/seven/css/components/tables.css b/core/themes/seven/css/components/tables.css
index a6443c1..6292d5b 100644
--- a/core/themes/seven/css/components/tables.css
+++ b/core/themes/seven/css/components/tables.css
@@ -63,7 +63,7 @@ th > a:after {
   right: 0;
   border-bottom: 2px solid transparent;
   -webkit-transition: all 0.1s;
-          transition: all 0.1s;
+  transition: all 0.1s;
 }
 th.active > a {
   color: #004875;

Fixed spacing issues on commit.

  • alexpott committed 360af27 on 8.0.x
    Issue #1664268 by droplet, G-raph, csakiistvan: Drop some browser...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.