buzinas / simple-scrollbar

Very simple and lightweight vanilla javascript library for creating a custom scrollbar cross-browser.
MIT License
575 stars 159 forks source link

Object.defineProperty(el, 'data-simple-scrollbar', new SimpleScrollbar(el)); is wrong #36

Closed swayok closed 6 years ago

swayok commented 6 years ago

When you do this: Object.defineProperty(el, 'data-simple-scrollbar', new SimpleScrollbar(el)); You will get {value: undefined, writable: false, enumerable: false, configurable: false} When calling Object.getOwnPropertyDescriptor(el, 'data-simple-scrollbar') Also el['data-simple-scrollbar'] will be undefined

Object.defineProperty() expects a PropertyDescriptor that must be an object with 'value' property;

So the correct version is: Object.defineProperty(el, 'data-simple-scrollbar', {value: new SimpleScrollbar(el)});

Please fix this. I'm not able to do a pull request right now

buzinas commented 6 years ago

This is fixed in latest master, thanks!