kutlugsahin / smooth-dnd

drag and drop library for javascript
MIT License
598 stars 146 forks source link

fix bug: throw TypeError: Illegal invocation #94

Closed echosoar closed 1 year ago

echosoar commented 1 year ago

If smooth-dnd is imported in a Module federation(https://webpack.js.org/concepts/module-federation/) module, and the main application also import smooth-dnd, this will cause the polyfill in it to be loaded multiple times.

This will cause the second time it is loaded, the first execution of the get method added by the polyfill will be triggered by the polyfill determining whether Node.prototype.firstElementChild exists, which will call Node.prototype.childNodes, which will trigger the browser to throw an 'TypeError: Illegal invocation' error