Skip to content

Commit

Permalink
umputun#299 make it working in IE11
Browse files Browse the repository at this point in the history
  • Loading branch information
Mavrin committed Apr 12, 2019
1 parent c352638 commit 4d401f1
Show file tree
Hide file tree
Showing 5 changed files with 53 additions and 4 deletions.
15 changes: 15 additions & 0 deletions web/app/common/closest-polyfill.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
if (!Element.prototype.matches) {
Element.prototype.matches = Element.prototype.msMatchesSelector || Element.prototype.webkitMatchesSelector;
}

if (!Element.prototype.closest) {
Element.prototype.closest = function(s) {
let el = this;

do {
if (el.matches(s)) return el;
el = el.parentElement || el.parentNode;
} while (el !== null && el.nodeType === 1);
return null;
};
}
2 changes: 2 additions & 0 deletions web/app/common/polyfills.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import 'core-js/es/promise';
import 'focus-visible';
import '@webcomponents/custom-elements';
import './closest-polyfill';

export default async function loadPolyfills() {
const fillCoreJs = async () => {
Expand Down
9 changes: 8 additions & 1 deletion web/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
"clean-webpack-plugin": "^2.0.1",
"copy-webpack-plugin": "^5.0.2",
"css-loader": "^2.1.1",
"document-register-element": "^1.13.1",
"eslint": "^5.15.3",
"eslint-config-prettier": "^4.1.0",
"eslint-plugin-jsx-a11y": "^6.2.1",
Expand Down Expand Up @@ -81,9 +82,9 @@
},
"dependencies": {
"@github/markdown-toolbar-element": "^0.2.0",
"@webcomponents/custom-elements": "^1.2.2",
"bem-react-helper": "^1.1.2",
"core-js": "^3.0.0",
"document-register-element": "^1.13.1",
"focus-visible": "^4.1.5",
"preact": "^8.4.2",
"preact-redux": "^2.0.3",
Expand Down
28 changes: 26 additions & 2 deletions web/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,32 @@ module.exports = () => ({
rules: [
{
test: /\.js(x?)$/,
exclude: /node_modules/,
use: 'babel-loader',
oneOf: [
{
include: /node_modules\/@github\/markdown-toolbar-element/,
use: {
loader: 'babel-loader',
options: {
presets: [
[
'@babel/preset-env',
{
targets: {
browsers: ['> 1%', 'android >= 4.4.4', 'ios >= 9', 'IE >= 11'],
},
useBuiltIns: 'usage',
corejs: 3,
},
],
],
},
},
},
{
exclude: /node_modules/,
use: 'babel-loader',
},
],
},
{
test: /\.ts(x?)$/,
Expand Down

0 comments on commit 4d401f1

Please sign in to comment.