Skip to content

[bug] Core clone util uses JQuery without jquery-sortablejs installed #2453

Description

@stwlam

I'm writing a plugin for third-party software where jQuery is present in globalThis. My plugin, however, makes no use of it, and Sortable's clone util function diverting to jQuery.clone has some catastrophic results. Without jquery-sortablejs installed, I think it's reasonable to expect that core Sortable won't be reaching for jQuery at all.

To Reproduce

  1. Set window.jQuery, otherwise undefined, to { clone: () => console.log("what is this") }
  2. Start dragging a Sortable element.
  3. Observe console output (along with error since the above won't clone).

Expected behavior

element.cloneNode is used.

Information

sortablejs = ^1.15.6
@types/sortablejs = ^1.15.8

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions