Merge pull request #162 from chenjiahan/dev

fix: remove unnecessary supports in mobile browsers
This commit is contained in:
neverland 2017-09-29 04:37:30 -05:00 committed by GitHub
commit 841b50cd95
8 changed files with 88 additions and 546 deletions

View File

@ -3,36 +3,14 @@ import Vue from 'vue';
var exportObj = {}; var exportObj = {};
if (!Vue.prototype.$isServer) { if (!Vue.prototype.$isServer) {
var docStyle = document.documentElement.style; var cssPrefix = '-webkit-';
var engine; var vendorPrefix = 'Webkit';
var translate3d = false;
if (window.opera && Object.prototype.toString.call(window.opera) === '[object Opera]') {
engine = 'presto';
} else if ('MozAppearance' in docStyle) {
engine = 'gecko';
} else if ('WebkitAppearance' in docStyle) {
engine = 'webkit';
} else if (typeof navigator.cpuClass === 'string') {
engine = 'trident';
}
var cssPrefix = { trident: '-ms-', gecko: '-moz-', webkit: '-webkit-', presto: '-o-' }[engine];
var vendorPrefix = { trident: 'ms', gecko: 'Moz', webkit: 'Webkit', presto: 'O' }[engine];
var helperElem = document.createElement('div');
var perspectiveProperty = vendorPrefix + 'Perspective';
var transformProperty = vendorPrefix + 'Transform'; var transformProperty = vendorPrefix + 'Transform';
var transformStyleName = cssPrefix + 'transform'; var transformStyleName = cssPrefix + 'transform';
var transitionProperty = vendorPrefix + 'Transition'; var transitionProperty = vendorPrefix + 'Transition';
var transitionStyleName = cssPrefix + 'transition'; var transitionStyleName = cssPrefix + 'transition';
var transitionEndProperty = vendorPrefix.toLowerCase() + 'TransitionEnd'; var transitionEndProperty = vendorPrefix.toLowerCase() + 'TransitionEnd';
if (helperElem.style[perspectiveProperty] !== undefined) {
translate3d = true;
}
var getTranslate = function(element) { var getTranslate = function(element) {
var result = { left: 0, top: 0 }; var result = { left: 0, top: 0 };
if (element === null || element.style === null) return result; if (element === null || element.style === null) return result;
@ -65,12 +43,7 @@ if (!Vue.prototype.$isServer) {
} }
cancelTranslateElement(element); cancelTranslateElement(element);
element.style[transformProperty] += ' translate(' + (x ? (x + 'px') : '0px') + ',' + (y ? (y + 'px') : '0px') + ') translateZ(0px)';
if (translate3d) {
element.style[transformProperty] += ' translate(' + (x ? (x + 'px') : '0px') + ',' + (y ? (y + 'px') : '0px') + ') translateZ(0px)';
} else {
element.style[transformProperty] += ' translate(' + (x ? (x + 'px') : '0px') + ',' + (y ? (y + 'px') : '0px') + ')';
}
}; };
var cancelTranslateElement = function(element) { var cancelTranslateElement = function(element) {

View File

@ -1,8 +1,8 @@
var gulp = require('gulp'); const gulp = require('gulp');
var postcss = require('gulp-postcss'); const postcss = require('gulp-postcss');
var cssmin = require('gulp-cssmin'); const cssmin = require('gulp-clean-css');
gulp.task('compile', function() { gulp.task('compile', () => {
return gulp.src('./src/*.css') return gulp.src('./src/*.css')
.pipe(postcss()) .pipe(postcss())
.pipe(cssmin()) .pipe(cssmin())

View File

@ -14,12 +14,11 @@
}, },
"license": "MIT", "license": "MIT",
"devDependencies": { "devDependencies": {
"autoprefixer": "^7.1.2", "autoprefixer": "^7.1.4",
"gulp": "^3.9.1", "gulp": "^3.9.1",
"gulp-cssmin": "^0.2.0", "gulp-clean-css": "^3.9.0",
"gulp-postcss": "^7.0.0", "gulp-postcss": "^7.0.0",
"postcss-easy-import": "^2.1.0", "postcss-easy-import": "^3.0.0",
"precss": "^2.0.0" "precss": "^2.0.0"
}, }
"dependencies": {}
} }

View File

@ -73,7 +73,6 @@ cat > $basepath/../src/icon.css <<EOF
/* Font smoothing. That was taken from TWBS */ /* Font smoothing. That was taken from TWBS */
-webkit-font-smoothing: antialiased; -webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
/* Uncomment for 3D effect */ /* Uncomment for 3D effect */
/* text-shadow: 1px 1px 1px rgba(127, 127, 127, 0.3); */ /* text-shadow: 1px 1px 1px rgba(127, 127, 127, 0.3); */

View File

@ -39,7 +39,6 @@
/* Font smoothing. That was taken from TWBS */ /* Font smoothing. That was taken from TWBS */
-webkit-font-smoothing: antialiased; -webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
/* Uncomment for 3D effect */ /* Uncomment for 3D effect */
/* text-shadow: 1px 1px 1px rgba(127, 127, 127, 0.3); */ /* text-shadow: 1px 1px 1px rgba(127, 127, 127, 0.3); */

View File

@ -67,5 +67,4 @@ textarea {
font-family: inherit; font-family: inherit;
margin: 0; margin: 0;
-webkit-appearance: none; -webkit-appearance: none;
-moz-appearance: none;
} }

View File

@ -86,7 +86,4 @@
-webkit-appearance: none; -webkit-appearance: none;
margin: 0; margin: 0;
} }
input[type=number] {
-moz-appearance: textfield;
}
} }

File diff suppressed because it is too large Load Diff