Repaint clean up

This commit is contained in:
Sam Potts 2019-06-03 20:12:21 +10:00
parent ab89e055de
commit c94ab2a39f
2 changed files with 10 additions and 9 deletions

View File

@ -73,9 +73,6 @@ function toggleFallback(toggle = false) {
.filter(part => part.trim() !== property) .filter(part => part.trim() !== property)
.join(','); .join(',');
} }
// Force a repaint as sometimes Safari doesn't want to fill the screen
setTimeout(() => repaint(this.target), 100);
} }
// Toggle button and fire events // Toggle button and fire events

View File

@ -2,7 +2,6 @@
// Animation utils // Animation utils
// ========================================================================== // ==========================================================================
import { toggleHidden } from './elements';
import is from './is'; import is from './is';
export const transitionEndEvent = (() => { export const transitionEndEvent = (() => {
@ -21,14 +20,19 @@ export const transitionEndEvent = (() => {
})(); })();
// Force repaint of element // Force repaint of element
export function repaint(element) { export function repaint(element, delay) {
setTimeout(() => { setTimeout(() => {
try { try {
toggleHidden(element, true); // eslint-disable-next-line no-param-reassign
element.offsetHeight; // eslint-disable-line element.hidden = true;
toggleHidden(element, false);
// eslint-disable-next-line no-unused-expressions
element.offsetHeight;
// eslint-disable-next-line no-param-reassign
element.hidden = false;
} catch (e) { } catch (e) {
// Do nothing // Do nothing
} }
}, 0); }, delay);
} }