From 2e076cb454b2fadc591cfce61d246b3387b0a9c8 Mon Sep 17 00:00:00 2001 From: Kamran Ahmed Date: Sun, 29 Apr 2018 23:25:46 +0200 Subject: [PATCH] Refactor and IE compatibility --- .eslintrc.json | 1 + package.json | 2 +- server.js | 2 +- src/core/element.js | 6 +++--- src/index.js | 8 ++++---- webpack.config.dev.js => webpack.config.demo.js | 0 6 files changed, 10 insertions(+), 9 deletions(-) rename webpack.config.dev.js => webpack.config.demo.js (100%) diff --git a/.eslintrc.json b/.eslintrc.json index 5720a25..96b5943 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -9,6 +9,7 @@ "no-plusplus": "off", "no-cond-assign": "off", "func-names": "off", + "no-continue": "off", "no-bitwise": "off", "class-methods-use-this": "off", "prefer-destructuring": "off", diff --git a/package.json b/package.json index 9350e53..3d477c0 100644 --- a/package.json +++ b/package.json @@ -6,7 +6,7 @@ "types": "types/index.d.ts", "scripts": { "start": "node server.js", - "build-demo": "NODE_ENV=production webpack --config webpack.config.dev.js", + "build-demo": "NODE_ENV=production webpack --config webpack.config.demo.js", "build": "webpack --config webpack.config.prod.js" }, "bugs": { diff --git a/server.js b/server.js index 48297d9..f93d0db 100644 --- a/server.js +++ b/server.js @@ -2,7 +2,7 @@ const webpack = require('webpack'); const WebpackDevServer = require('webpack-dev-server'); const opn = require('opn'); -const config = require('./webpack.config.dev'); +const config = require('./webpack.config.demo'); const PORT = 3000; const HOST = 'localhost'; diff --git a/src/core/element.js b/src/core/element.js index 90cc647..da60b28 100644 --- a/src/core/element.js +++ b/src/core/element.js @@ -219,9 +219,9 @@ export default class Element { this.node.classList.remove(CLASS_POSITION_RELATIVE); const stackFixes = this.document.querySelectorAll(`.${CLASS_FIX_STACKING_CONTEXT}`); - stackFixes.forEach((stackFix) => { - stackFix.classList.remove(CLASS_FIX_STACKING_CONTEXT); - }); + for (let counter = 0; counter < stackFixes.length; counter++) { + stackFixes[counter].classList.remove(CLASS_FIX_STACKING_CONTEXT); + } } /** diff --git a/src/index.js b/src/index.js index f24ccb7..8ac92ee 100644 --- a/src/index.js +++ b/src/index.js @@ -248,14 +248,14 @@ export default class Driver { defineSteps(steps) { this.steps = []; - steps.forEach((step, index) => { - const element = this.prepareElementFromStep(step, steps, index); + for (let counter = 0; counter < steps.length; counter++) { + const element = this.prepareElementFromStep(steps[counter], steps, counter); if (!element) { - return; + continue; } this.steps.push(element); - }); + } } /** diff --git a/webpack.config.dev.js b/webpack.config.demo.js similarity index 100% rename from webpack.config.dev.js rename to webpack.config.demo.js