react-sortablejs icon indicating copy to clipboard operation
react-sortablejs copied to clipboard

IE syntax error after v6.0.3

Open karesztrk opened this issue 3 years ago • 4 comments

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

karesztrk avatar Jan 19 '22 11:01 karesztrk

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?

andresin87 avatar Jan 20 '22 21:01 andresin87

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?

karesztrk avatar Jan 21 '22 06:01 karesztrk

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

andresin87 avatar Jan 21 '22 10:01 andresin87

@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

karesztrk avatar Jan 21 '22 11:01 karesztrk