Skip to content

Select2 inside ShadowRoot Broke In 4.0.11 #5682

@pm-michael

Description

@pm-michael

#5584 breaks the usage of Select2 inside a ShadowRoot, because $.contains() returns false, even though the Node is actually connected to the document.

I'd propose changing the following code:

    if ($.contains(document.body, $offsetParent[0])) {
      parentOffset = $offsetParent.offset();
    }

To this:

    if ($offsetParent[0].isConnected) {
      parentOffset = $offsetParent.offset();
    }

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions