From 03d6cb58db48a2c70a17dec683d2ffc8d6f4a90f Mon Sep 17 00:00:00 2001 From: Nathan Cahill Date: Wed, 10 Jun 2020 17:31:11 +0200 Subject: [PATCH] drop support for ie 8 --- packages/splitjs/src/split.js | 56 ++++++++++++----------------------- 1 file changed, 19 insertions(+), 37 deletions(-) diff --git a/packages/splitjs/src/split.js b/packages/splitjs/src/split.js index 1bfde38ae..172a648f4 100644 --- a/packages/splitjs/src/split.js +++ b/packages/splitjs/src/split.js @@ -1,6 +1,6 @@ // The programming goals of Split.js are to deliver readable, understandable and // maintainable code, while at the same time manually optimizing for tiny minified file size, -// browser compatibility without additional requirements, graceful fallback (IE8 is supported) +// browser compatibility without additional requirements // and very few assumptions about the user's page layout. const global = window const { document } = global @@ -16,10 +16,6 @@ const bGutterSize = '_c' const HORIZONTAL = 'horizontal' const NOOP = () => false -// Figure out if we're in IE8 or not. IE8 will still render correctly, -// but will be static instead of draggable. -const isIE8 = global.attachEvent && !global[addEventListener] - // Helper function determines which prefixes of CSS calc we need. // We only need to do this once on startup, when this anonymous function is called. // @@ -92,11 +88,7 @@ const defaultElementStyleFn = (dim, size, gutSize) => { const style = {} if (!isString(size)) { - if (!isIE8) { - style[dim] = `${calc}(${size}% - ${gutSize}px)` - } else { - style[dim] = `${size}%` - } + style[dim] = `${calc}(${size}% - ${gutSize}px)` } else { style[dim] = size } @@ -623,30 +615,27 @@ const Split = (idsOption, options = {}) => { // staticly assigning sizes without draggable gutters. Assigns a string // to `size`. // - // IE9 and above - if (!isIE8) { - // Create gutter elements for each pair. - if (i > 0) { - const gutterElement = gutter(i, direction, element.element) - setGutterSize(gutterElement, gutterSize, i) + // Create gutter elements for each pair. + if (i > 0) { + const gutterElement = gutter(i, direction, element.element) + setGutterSize(gutterElement, gutterSize, i) - // Save bound event listener for removal later - pair[gutterStartDragging] = startDragging.bind(pair) + // Save bound event listener for removal later + pair[gutterStartDragging] = startDragging.bind(pair) - // Attach bound event listener - gutterElement[addEventListener]( - 'mousedown', - pair[gutterStartDragging], - ) - gutterElement[addEventListener]( - 'touchstart', - pair[gutterStartDragging], - ) + // Attach bound event listener + gutterElement[addEventListener]( + 'mousedown', + pair[gutterStartDragging], + ) + gutterElement[addEventListener]( + 'touchstart', + pair[gutterStartDragging], + ) - parent.insertBefore(gutterElement, element.element) + parent.insertBefore(gutterElement, element.element) - pair.gutter = gutterElement - } + pair.gutter = gutterElement } setElementSize( @@ -744,13 +733,6 @@ const Split = (idsOption, options = {}) => { }) } - if (isIE8) { - return { - setSizes, - destroy, - } - } - return { setSizes, getSizes,