Skip to content

Commit

Permalink
Merge pull request #343 from natalan/fix-ie-11-compatibility
Browse files Browse the repository at this point in the history
Fix ie 11 compatibility
  • Loading branch information
crabbly authored Jun 10, 2019
2 parents c16e238 + c8420d8 commit 7779624
Show file tree
Hide file tree
Showing 5 changed files with 46 additions and 35 deletions.
12 changes: 12 additions & 0 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"presets": [
[
"@babel/preset-env",
{
"targets": {
"ie": "8"
}
}
]
]
}
46 changes: 23 additions & 23 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,29 +9,29 @@
"license": "MIT",
"dependencies": {},
"devDependencies": {
"babel-core": "^6.26.3",
"babel-loader": "^7.1.5",
"babel-preset-env": "^1.7.0",
"coveralls": "^3.0.2",
"css-loader": "^2.1.1",
"istanbul-instrumenter-loader": "^3.0.1",
"jasmine-core": "^3.2.1",
"karma": "^4.0.1",
"karma-chrome-launcher": "^2.2.0",
"karma-coverage": "^1.1.2",
"karma-jasmine": "^2.0.1",
"karma-phantomjs-launcher": "^1.0.4",
"karma-sourcemap-loader": "^0.3.7",
"karma-webpack": "^3.0.5",
"mini-css-extract-plugin": "^0.5.0",
"node-sass": "^4.9.3",
"optimize-css-assets-webpack-plugin": "^5.0.0",
"sass-loader": "^7.1.0",
"standard": "^12.0.1",
"uglifyjs-webpack-plugin": "^2.0.1",
"webpack": "^4.29.6",
"webpack-cli": "^3.2.3",
"webpack-dev-server": "^3.2.1"
"@babel/core": "7.4.5",
"@babel/preset-env": "7.4.5",
"babel-loader": "8.0.6",
"coveralls": "3.0.4",
"css-loader": "2.1.1",
"istanbul-instrumenter-loader": "3.0.1",
"jasmine-core": "3.4.0",
"karma": "4.1.0",
"karma-chrome-launcher": "2.2.0",
"karma-coverage": "1.1.2",
"karma-jasmine": "2.0.1",
"karma-phantomjs-launcher": "1.0.4",
"karma-sourcemap-loader": "0.3.7",
"karma-webpack": "3.0.5",
"mini-css-extract-plugin": "0.7.0",
"node-sass": "4.12.0",
"optimize-css-assets-webpack-plugin": "5.0.1",
"sass-loader": "7.1.0",
"standard": "12.0.1",
"uglifyjs-webpack-plugin": "2.1.3",
"webpack": "4.33.0",
"webpack-cli": "3.3.3",
"webpack-dev-server": "3.7.1"
},
"scripts": {
"test": "standard && karma start",
Expand Down
7 changes: 4 additions & 3 deletions src/js/html.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,15 @@ function cloneElement (element, params) {
const clone = element.cloneNode()

// Loop over and process the children elements / nodes (including text nodes)
for (let child of element.childNodes) {
const childNodesArray = Array.prototype.slice.call(element.childNodes)
for (let i = 0; i < childNodesArray.length; i++) {
// Check if we are skiping the current element
if (params.ignoreElements.indexOf(child.id) !== -1) {
if (params.ignoreElements.indexOf(childNodesArray[i].id) !== -1) {
continue
}

// Clone the child element
const clonedChild = cloneElement(child, params)
const clonedChild = cloneElement(childNodesArray[i], params)

// Attach the cloned child to the cloned parent node
clone.appendChild(clonedChild)
Expand Down
11 changes: 6 additions & 5 deletions src/js/print.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,12 @@ function performPrint (iframeElement, params) {
}

function loadIframeImages (images) {
const promises = []

for (let image of images) {
if (image.src && image.src !== window.location.href) promises.push(loadIframeImage(image))
}
const promises = Array.prototype.slice.call(images).reduce((memo, image) => {
if (image.src && image.src !== window.location.href) {
memo.push(loadIframeImage(image))
}
return memo
}, [])

return Promise.all(promises)
}
Expand Down
5 changes: 1 addition & 4 deletions webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,7 @@ module.exports = {
test: /\.js$/,
exclude: /node_modules/,
use: {
loader: 'babel-loader',
options: {
presets: ['env']
}
loader: 'babel-loader'
}
},
// TODO: Configure istanbul to interpret how webpack bundles files
Expand Down

0 comments on commit 7779624

Please sign in to comment.