Skip to content

Commit

Permalink
use specific polyfills instead of importing every polyfill in the wor…
Browse files Browse the repository at this point in the history
…ld (fix #120 #112)
  • Loading branch information
Adrien Grsmto committed Oct 31, 2017
1 parent 36a416c commit ac88ff1
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 17 deletions.
16 changes: 1 addition & 15 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -1,17 +1,3 @@
{
"plugins": [
"add-module-exports"
],
"presets": [
["env", {
"useBuiltIns": "entry",
"debug": true,
"targets": {
"browsers": [
"> 1%",
"last 2 versions"
]
}
}]
]
"presets": ["@babel/env"]
}
5 changes: 3 additions & 2 deletions src/simplebar.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import 'core-js/fn/array/from';

import scrollbarWidth from 'scrollbarwidth';
import debounce from 'lodash.debounce';
import ResizeObserver from 'resize-observer-polyfill';

import 'babel-polyfill';
import './simplebar.css';

export default class SimpleBar {
Expand Down Expand Up @@ -160,7 +161,7 @@ export default class SimpleBar {

initDOM() {
// make sure this element doesn't have the elements yet
if (Array.from(this.el.children).find(child => child.classList.contains(this.classNames.scrollContent))) {
if (Array.from(this.el.children).filter(child => child.classList.contains(this.classNames.scrollContent)).length) {
// assume that element has his DOM already initiated
this.trackX = this.el.querySelector(`.${this.classNames.track}.horizontal`);
this.trackY = this.el.querySelector(`.${this.classNames.track}.vertical`);
Expand Down

0 comments on commit ac88ff1

Please sign in to comment.