Skip to content

Commit

Permalink
remove silly llm comments
Browse files Browse the repository at this point in the history
  • Loading branch information
OrionReed committed Dec 11, 2024
1 parent da7e5ca commit 164acc3
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions demo/moveBefore.html
Original file line number Diff line number Diff line change
Expand Up @@ -70,14 +70,15 @@
console.warn('Note: moveBefore() API requires Chrome Canary with chrome://flags/#atomic-move enabled');
}

let isMoving = false; // Flag to prevent recursive moves
// TODO: investigate / figure out how to avoid the need for this
let isMoving = false;

document.addEventListener('transform', (e) => {
if (isMoving) return; // Prevent recursive calls

const shape = e.target;
if (!shape.moveBefore) {
return; // Exit if moveBefore is not supported
return;
}

const rect = shape.getBoundingClientRect();
Expand All @@ -94,12 +95,11 @@
}
}

// If not in any container, move to body
if (shape.parentElement !== document.body) {
document.body.moveBefore(shape, document.body.firstChild);
}
} finally {
isMoving = false; // Ensure flag is reset even if there's an error
isMoving = false;
}
});
</script>
Expand Down

0 comments on commit 164acc3

Please sign in to comment.