mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-18 19:21:34 +08:00
hairline shim
This commit is contained in:
@ -134,6 +134,7 @@ gulp.task('transpile', function() {
|
|||||||
'ionic/**/*.ts',
|
'ionic/**/*.ts',
|
||||||
'ionic/**/*.js',
|
'ionic/**/*.js',
|
||||||
'!ionic/components/*/test/**/*',
|
'!ionic/components/*/test/**/*',
|
||||||
|
'!ionic/util/hairline.js',
|
||||||
'!ionic/init.js',
|
'!ionic/init.js',
|
||||||
'!ionic/util/test/*'
|
'!ionic/util/test/*'
|
||||||
]
|
]
|
||||||
@ -155,7 +156,7 @@ gulp.task('transpile', function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
gulp.task('bundle.js', function() {
|
gulp.task('bundle.js', function() {
|
||||||
return gulp.src(['dist/js/es5/ionic/**/*.js', 'ionic/init.js'])
|
return gulp.src(['dist/js/es5/ionic/**/*.js', 'ionic/util/hairline.js', 'ionic/init.js'])
|
||||||
.pipe(concat('ionic.bundle.js'))
|
.pipe(concat('ionic.bundle.js'))
|
||||||
.pipe(gulp.dest('dist/js/'));
|
.pipe(gulp.dest('dist/js/'));
|
||||||
});
|
});
|
||||||
|
@ -1,19 +1,6 @@
|
|||||||
|
|
||||||
(function(document){
|
(function(document){
|
||||||
|
|
||||||
// hairline polyfill
|
|
||||||
if (window.devicePixelRatio >= 2) {
|
|
||||||
var harlineEle = document.createElement('div');
|
|
||||||
harlineEle.style.border = '.5px solid transparent';
|
|
||||||
document.body.appendChild(harlineEle);
|
|
||||||
|
|
||||||
if (harlineEle.offsetHeight == 1) {
|
|
||||||
document.body.classList.add('hairlines');
|
|
||||||
}
|
|
||||||
document.body.removeChild(harlineEle);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
var ionicImport = System.import('ionic/components/app/app');
|
var ionicImport = System.import('ionic/components/app/app');
|
||||||
|
|
||||||
function importApp(module) {
|
function importApp(module) {
|
||||||
|
21
ionic/util/hairline.js
Normal file
21
ionic/util/hairline.js
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
|
||||||
|
/**
|
||||||
|
* Hairline Shim
|
||||||
|
* Add the "hairline" CSS class name to the body tag
|
||||||
|
* if the browser supports subpixels.
|
||||||
|
*/
|
||||||
|
|
||||||
|
(function(document){
|
||||||
|
|
||||||
|
if (window.devicePixelRatio >= 2) {
|
||||||
|
var hairlineEle = document.createElement('div');
|
||||||
|
hairlineEle.style.border = '.5px solid transparent';
|
||||||
|
document.body.appendChild(hairlineEle);
|
||||||
|
|
||||||
|
if (hairlineEle.offsetHeight === 1) {
|
||||||
|
document.body.classList.add('hairlines');
|
||||||
|
}
|
||||||
|
document.body.removeChild(hairlineEle);
|
||||||
|
}
|
||||||
|
|
||||||
|
})(document);
|
Reference in New Issue
Block a user