SortableJS / react-sortablejs

React bindings for SortableJS
http://sortablejs.github.io/react-sortablejs/
MIT License
2.05k stars 209 forks source link

IE syntax error after v6.0.3 #223

Open karesztrk opened 2 years ago

karesztrk commented 2 years ago

Describe the bug React SortableJS is broken in IE because of a Syntax error

To Reproduce Steps to reproduce the behavior:

  1. Install react-sortablejs ^6.0.3
  2. Start the application
  3. Open the application in Internet Explorer
  4. See error

Expected behavior The application is opened and there's no Syntax error.

Information This is required. Issues without this critical information will be closed.

Versions - Look in your package.json for this information: react-sortable = ^6.0.3 react = ^17.0.2

Additional context Add any other context about the problem here.

See the image below. IE points me to this line as the root of the cause. Tho' its its minified .... it might not be useful to debug. image

andresin87 commented 2 years ago

I think its due to the insertBefore fn

IE requires as 2nd argument a valid node or null, so be sure that parent has childNodes to avoid errors

Maybe looping some empty element?

karesztrk commented 2 years ago

I'm not sure @andresin87. But I'm pretty sure that I'm not looping over empty elements with <ReactSortable>. FYI this only happens after v6.0.0. Do you think that we need an insertBefore polyfill for this?

andresin87 commented 2 years ago

Could you try and let us know if it's still hapening?

karesztrk commented 2 years ago

@andresin87 Before i would go that way. Why do you think that its caused by insertBefore? As I see its only used in util#insertNodeAt fn. And I see now change regarding this if I compare the released versions: https://github.com/SortableJS/react-sortablejs/compare/v6.0.0...v6.0.3