mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2026-03-13 10:22:08 +08:00
@@ -14,6 +14,7 @@ import {Events} from '../util/events';
|
||||
import {NavRegistry} from '../components/nav/nav-registry';
|
||||
import {Translate} from '../translation/translate';
|
||||
import {ClickBlock} from '../util/click-block';
|
||||
import {FeatureDetect} from '../util/feature-detect';
|
||||
import {TapClick} from '../components/tap-click/tap-click';
|
||||
import * as dom from '../util/dom';
|
||||
|
||||
@@ -34,8 +35,9 @@ export function ionicProviders(config) {
|
||||
|
||||
let events = new Events();
|
||||
let tapClick = new TapClick(app, config, window, document);
|
||||
let featureDetect = new FeatureDetect();
|
||||
|
||||
setupDom(window, document, config, platform);
|
||||
setupDom(window, document, config, platform, featureDetect);
|
||||
bindEvents(window, document, platform, events);
|
||||
|
||||
// prepare the ready promise to fire....when ready
|
||||
@@ -46,6 +48,7 @@ export function ionicProviders(config) {
|
||||
provide(IonicConfig, {useValue: config}),
|
||||
provide(IonicPlatform, {useValue: platform}),
|
||||
provide(TapClick, {useValue: tapClick}),
|
||||
provide(FeatureDetect, {useValue: featureDetect}),
|
||||
provide(Events, {useValue: events}),
|
||||
IonicForm,
|
||||
IonicKeyboard,
|
||||
@@ -61,7 +64,7 @@ export function ionicProviders(config) {
|
||||
}
|
||||
|
||||
|
||||
function setupDom(window, document, config, platform) {
|
||||
function setupDom(window, document, config, platform, featureDetect) {
|
||||
let bodyEle = document.body;
|
||||
if (!bodyEle) {
|
||||
return dom.ready(function() {
|
||||
@@ -96,22 +99,8 @@ function setupDom(window, document, config, platform) {
|
||||
bodyEle.classList.add('enable-hover');
|
||||
}
|
||||
|
||||
/**
|
||||
* Hairline Shim
|
||||
* Add the "hairline" CSS class name to the body tag
|
||||
* if the browser supports subpixels.
|
||||
*/
|
||||
if (window.devicePixelRatio >= 2) {
|
||||
var hairlineEle = document.createElement('div');
|
||||
hairlineEle.style.border = '.5px solid transparent';
|
||||
bodyEle.appendChild(hairlineEle);
|
||||
|
||||
if (hairlineEle.offsetHeight === 1) {
|
||||
bodyEle.classList.add('hairlines');
|
||||
}
|
||||
bodyEle.removeChild(hairlineEle);
|
||||
}
|
||||
|
||||
// run feature detection tests
|
||||
featureDetect.run(window, document);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user