Skip to content

Commit

Permalink
Fix element remove observer (#2258)
Browse files Browse the repository at this point in the history
  • Loading branch information
mvorisek authored Feb 18, 2025
1 parent 6e1140b commit 443fa33
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 8 deletions.
6 changes: 4 additions & 2 deletions js/src/Helper/elementRemoveObserver.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,10 @@ function handleObserverRecords(elem, mutationRecords) {

const removedElems = new Set();
for (const mutationRecord of mutationRecords) {
for (const removedElem of observedChildren.intersection(mutationRecord.removedNodes)) {
removedElems.add(removedElem);
for (const removedNode of mutationRecord.removedNodes) {
if (observedChildren.has(removedNode)) {
removedElems.add(removedNode);
}
}
}

Expand Down
6 changes: 4 additions & 2 deletions public/js/atkjs-ui.js
Original file line number Diff line number Diff line change
Expand Up @@ -178,8 +178,10 @@ function handleObserverRecords(elem, mutationRecords) {
const observedChildren = observedChildrenByElement.get(elem);
const removedElems = new Set();
for (const mutationRecord of mutationRecords) {
for (const removedElem of observedChildren.intersection(mutationRecord.removedNodes)) {
removedElems.add(removedElem);
for (const removedNode of mutationRecord.removedNodes) {
if (observedChildren.has(removedNode)) {
removedElems.add(removedNode);
}
}
}
for (const removedElem of removedElems) {
Expand Down
2 changes: 1 addition & 1 deletion public/js/atkjs-ui.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion public/js/atkjs-ui.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion public/js/atkjs-ui.min.js.map

Large diffs are not rendered by default.

4 changes: 3 additions & 1 deletion tests-behat/tab.feature
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,10 @@ Feature: Tab
When I hide js modal

Scenario: URL exception is displayed
Then I should not see "<title>404 Not Found</title>"
When I click tab with title "URL 404"
Then Modal is open with text "API Server Error"
# TODO text() xpath contains support
# Then Modal is open with text "<title>404 Not Found</title>"
Then I should see "<title>404 Not Found</title>"
When I hide js modal
Then I should not see "<title>404 Not Found</title>"

0 comments on commit 443fa33

Please sign in to comment.