Select2 inside ShadowRoot Broke In 4.0.11
See original GitHub issue#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();
}
Issue Analytics
- State:
- Created 4 years ago
- Reactions:2
- Comments:7 (2 by maintainers)
Top Results From Across the Web
select2 - ShadowRoot 내부의 Select2가 4.0.11에서 중단되었습니다 ...
5584는 노드가 실제로 문서에 연결되어 있어도 $.contains() 가 false를 반환하기 때문에 ShadowRoot 내에서 Select2 사용을 중단합니다.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Probably going to switch this to
Just to handle IE/Edge/older browsers when they aren’t using the shadow DOM (because let’s be honest, they won’t be using the shadow DOM if they’re old enough to not support
isConnected
).Since 4.0.11 (4.0.10 works) I also get wrong offsets for the popup:
This is also inside a Shadow DOM.