Skip to content

Commit 7779624

Browse files
authored
Merge pull request #343 from natalan/fix-ie-11-compatibility
Fix ie 11 compatibility
2 parents c16e238 + c8420d8 commit 7779624

File tree

5 files changed

+46
-35
lines changed

5 files changed

+46
-35
lines changed

.babelrc

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"presets": [
3+
[
4+
"@babel/preset-env",
5+
{
6+
"targets": {
7+
"ie": "8"
8+
}
9+
}
10+
]
11+
]
12+
}

package.json

+23-23
Original file line numberDiff line numberDiff line change
@@ -9,29 +9,29 @@
99
"license": "MIT",
1010
"dependencies": {},
1111
"devDependencies": {
12-
"babel-core": "^6.26.3",
13-
"babel-loader": "^7.1.5",
14-
"babel-preset-env": "^1.7.0",
15-
"coveralls": "^3.0.2",
16-
"css-loader": "^2.1.1",
17-
"istanbul-instrumenter-loader": "^3.0.1",
18-
"jasmine-core": "^3.2.1",
19-
"karma": "^4.0.1",
20-
"karma-chrome-launcher": "^2.2.0",
21-
"karma-coverage": "^1.1.2",
22-
"karma-jasmine": "^2.0.1",
23-
"karma-phantomjs-launcher": "^1.0.4",
24-
"karma-sourcemap-loader": "^0.3.7",
25-
"karma-webpack": "^3.0.5",
26-
"mini-css-extract-plugin": "^0.5.0",
27-
"node-sass": "^4.9.3",
28-
"optimize-css-assets-webpack-plugin": "^5.0.0",
29-
"sass-loader": "^7.1.0",
30-
"standard": "^12.0.1",
31-
"uglifyjs-webpack-plugin": "^2.0.1",
32-
"webpack": "^4.29.6",
33-
"webpack-cli": "^3.2.3",
34-
"webpack-dev-server": "^3.2.1"
12+
"@babel/core": "7.4.5",
13+
"@babel/preset-env": "7.4.5",
14+
"babel-loader": "8.0.6",
15+
"coveralls": "3.0.4",
16+
"css-loader": "2.1.1",
17+
"istanbul-instrumenter-loader": "3.0.1",
18+
"jasmine-core": "3.4.0",
19+
"karma": "4.1.0",
20+
"karma-chrome-launcher": "2.2.0",
21+
"karma-coverage": "1.1.2",
22+
"karma-jasmine": "2.0.1",
23+
"karma-phantomjs-launcher": "1.0.4",
24+
"karma-sourcemap-loader": "0.3.7",
25+
"karma-webpack": "3.0.5",
26+
"mini-css-extract-plugin": "0.7.0",
27+
"node-sass": "4.12.0",
28+
"optimize-css-assets-webpack-plugin": "5.0.1",
29+
"sass-loader": "7.1.0",
30+
"standard": "12.0.1",
31+
"uglifyjs-webpack-plugin": "2.1.3",
32+
"webpack": "4.33.0",
33+
"webpack-cli": "3.3.3",
34+
"webpack-dev-server": "3.7.1"
3535
},
3636
"scripts": {
3737
"test": "standard && karma start",

src/js/html.js

+4-3
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,15 @@ function cloneElement (element, params) {
3030
const clone = element.cloneNode()
3131

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

3940
// Clone the child element
40-
const clonedChild = cloneElement(child, params)
41+
const clonedChild = cloneElement(childNodesArray[i], params)
4142

4243
// Attach the cloned child to the cloned parent node
4344
clone.appendChild(clonedChild)

src/js/print.js

+6-5
Original file line numberDiff line numberDiff line change
@@ -68,11 +68,12 @@ function performPrint (iframeElement, params) {
6868
}
6969

7070
function loadIframeImages (images) {
71-
const promises = []
72-
73-
for (let image of images) {
74-
if (image.src && image.src !== window.location.href) promises.push(loadIframeImage(image))
75-
}
71+
const promises = Array.prototype.slice.call(images).reduce((memo, image) => {
72+
if (image.src && image.src !== window.location.href) {
73+
memo.push(loadIframeImage(image))
74+
}
75+
return memo
76+
}, [])
7677

7778
return Promise.all(promises)
7879
}

webpack.config.js

+1-4
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,7 @@ module.exports = {
2222
test: /\.js$/,
2323
exclude: /node_modules/,
2424
use: {
25-
loader: 'babel-loader',
26-
options: {
27-
presets: ['env']
28-
}
25+
loader: 'babel-loader'
2926
}
3027
},
3128
// TODO: Configure istanbul to interpret how webpack bundles files

0 commit comments

Comments
 (0)