mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-02-04 14:24:53 +08:00
Fixed a bug where an infinite loop occurred in Firefox when compareDocumentPosition results in DOCUMENT_POSITION_DISCONNECTED.
In both Chrome and Firefox, when an element is inside a webcomponent the comparison results in DOCUMENT_POSITION_DISCONNECTED. But in Firefox the element result in DOCUMENT_POSITION_FOLLOWING too, leading to an infinite loop.
This commit is contained in:
parent
4d795da488
commit
3dd4e91ff5
@ -1416,8 +1416,12 @@ class SpineWebComponentOverlay extends HTMLElement implements OverlayAttributes,
|
||||
addWidget (widget: SpineWebComponentWidget) {
|
||||
this.skeletonList.push(widget);
|
||||
this.intersectionObserver?.observe(widget.getHTMLElementReference());
|
||||
if (this.loaded && (this.compareDocumentPosition(widget) & Node.DOCUMENT_POSITION_FOLLOWING)) {
|
||||
this.parentElement!.appendChild(this);
|
||||
if (this.loaded) {
|
||||
const comparison = this.compareDocumentPosition(widget);
|
||||
// DOCUMENT_POSITION_DISCONNECTED is needed when a widget is inside the overlay (due to followBone)
|
||||
if ((comparison & Node.DOCUMENT_POSITION_FOLLOWING) && !(comparison & Node.DOCUMENT_POSITION_DISCONNECTED)) {
|
||||
this.parentElement!.appendChild(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user