mirror of
https://github.com/tenrok/OverlayScrollbars.git
synced 2026-06-20 23:20:45 +03:00
add ms edge optimizations
This commit is contained in:
+19
-7
@@ -10,10 +10,11 @@ import { clientSize, from, getBoundingClientRect, style, parent, addClass, WH, r
|
|||||||
|
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
const msie11 = !!window.MSInputMethodContext && !!document.documentMode;
|
const msie11 = !!window.MSInputMethodContext && !!document.documentMode;
|
||||||
|
const msedge = window.navigator.userAgent.indexOf('Edge') > -1;
|
||||||
const firefox = navigator.userAgent.toLowerCase().indexOf('firefox') > -1;
|
const firefox = navigator.userAgent.toLowerCase().indexOf('firefox') > -1;
|
||||||
|
|
||||||
const useContentElement = false;
|
const useContentElement = false;
|
||||||
const fixedDigits = msie11 ? 1 : 10;
|
const fixedDigits = msie11 || msedge ? 1 : 10;
|
||||||
const fixedDigitsOffset = firefox ? 3 : fixedDigits; // ff does roundign errors here only
|
const fixedDigitsOffset = firefox ? 3 : fixedDigits; // ff does roundign errors here only
|
||||||
|
|
||||||
const startBtn: HTMLButtonElement | null = document.querySelector('#start');
|
const startBtn: HTMLButtonElement | null = document.querySelector('#start');
|
||||||
@@ -225,11 +226,13 @@ const containerTest = async () => {
|
|||||||
await iterateHeight(async () => {
|
await iterateHeight(async () => {
|
||||||
await iterateWidth(async () => {
|
await iterateWidth(async () => {
|
||||||
await iterateBorder(async () => {
|
await iterateBorder(async () => {
|
||||||
// assume this part isn't critical for IE11, to boost test speed
|
// assume this part isn't critical for IE11 and edge, to boost test speed
|
||||||
if (!msie11) {
|
if (!msie11 && !msedge) {
|
||||||
await iterateFloat(async () => {
|
await iterateFloat(async () => {
|
||||||
await iterateMargin();
|
await iterateMargin();
|
||||||
});
|
});
|
||||||
|
} else if (msedge) {
|
||||||
|
await iterateMargin();
|
||||||
}
|
}
|
||||||
|
|
||||||
await iteratePadding();
|
await iteratePadding();
|
||||||
@@ -305,8 +308,17 @@ const overflowTest = async () => {
|
|||||||
height: comparison!.scrollHeight - comparison!.clientHeight,
|
height: comparison!.scrollHeight - comparison!.clientHeight,
|
||||||
};
|
};
|
||||||
|
|
||||||
should.equal(overflowAmountCheck.width, width ? 1 : 0, 'Correct smallest possible overflow width.');
|
if (width) {
|
||||||
should.equal(overflowAmountCheck.height, height ? 1 : 0, 'Correct smallest possible overflow height.');
|
should.ok(overflowAmountCheck.width >= 1, 'Correct smallest possible overflow width.');
|
||||||
|
} else {
|
||||||
|
should.equal(overflowAmountCheck.width, 0, 'Correct smallest possible overflow width.');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (height) {
|
||||||
|
should.ok(overflowAmountCheck.height >= 1, 'Correct smallest possible overflow height.');
|
||||||
|
} else {
|
||||||
|
should.equal(overflowAmountCheck.height, 0, 'Correct smallest possible overflow height.');
|
||||||
|
}
|
||||||
|
|
||||||
style(targetResize, styleObj);
|
style(targetResize, styleObj);
|
||||||
|
|
||||||
@@ -365,8 +377,8 @@ const start = async () => {
|
|||||||
setTestResult(null);
|
setTestResult(null);
|
||||||
|
|
||||||
target?.removeAttribute('style');
|
target?.removeAttribute('style');
|
||||||
//await containerTest();
|
await containerTest();
|
||||||
await overflowTest();
|
//await overflowTest();
|
||||||
|
|
||||||
setTestResult(true);
|
setTestResult(true);
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user