Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(framework): remove internet explorer related checks #8494

Merged
merged 1 commit into from
Mar 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions packages/base/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@ import {
// Device.ts
import {
supportsTouch,
isIE,
isSafari,
isChrome,
isFirefox,
Expand Down Expand Up @@ -187,7 +186,6 @@ export {

// Device.ts
supportsTouch,
isIE,
isSafari,
isChrome,
isFirefox,
Expand Down
17 changes: 5 additions & 12 deletions packages/base/src/Device.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,12 @@ const internals = {
}
return "ontouchstart" in window || navigator.maxTouchPoints > 0;
},
get ie() {
if (isSSR) {
return false;
}
return /(msie|trident)/i.test(internals.userAgent);
},

get chrome() {
if (isSSR) {
return false;
}
return !internals.ie && /(Chrome|CriOS)/.test(internals.userAgent);
return /(Chrome|CriOS)/.test(internals.userAgent);
},
get firefox() {
if (isSSR) {
Expand All @@ -35,13 +30,13 @@ const internals = {
if (isSSR) {
return false;
}
return !internals.ie && !internals.chrome && /(Version|PhantomJS)\/(\d+\.\d+).*Safari/.test(internals.userAgent);
return !internals.chrome && /(Version|PhantomJS)\/(\d+\.\d+).*Safari/.test(internals.userAgent);
},
get webkit() {
if (isSSR) {
return false;
}
return !internals.ie && /webkit/.test(internals.userAgent);
return /webkit/.test(internals.userAgent);
},
get windows() {
if (isSSR) {
Expand Down Expand Up @@ -156,11 +151,10 @@ const detectTablet = () => {
return;
}

tablet = (internals.ie && internals.userAgent.indexOf("Touch") !== -1) || (internals.android && !internals.androidPhone);
tablet = internals.userAgent.indexOf("Touch") !== -1 || (internals.android && !internals.androidPhone);
};

const supportsTouch = (): boolean => internals.touch;
const isIE = (): boolean => internals.ie;
const isSafari = (): boolean => internals.safari;
const isChrome = (): boolean => internals.chrome;
const isFirefox = (): boolean => internals.firefox;
Expand Down Expand Up @@ -200,7 +194,6 @@ const isAndroid = (): boolean => {

export {
supportsTouch,
isIE,
isSafari,
isChrome,
isFirefox,
Expand Down
1 change: 0 additions & 1 deletion packages/base/test/ssr/Device.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ describe('SSR / Device', () => {

it('all detections should return false', () => {
assert.strictEqual(Device.supportsTouch(), false, `'supportsTouch' should be false`);
assert.strictEqual(Device.isIE(), false, `'isIE' should be false`);
assert.strictEqual(Device.isSafari(), false, `'isSafari' should be false`);
assert.strictEqual(Device.isChrome(), false, `'isChrome' should be false`);
assert.strictEqual(Device.isFirefox(), false, `'isFirefox' should be false`);
Expand Down