You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This GitHub issue is for collecting web developer signals for moveBefore().
The moveBefore() DOM method relocates a node while preserving its state. For example, you can move the active element without losing focus, move an animated element without resetting the animation, or move an iframe without reloading its content.
Browser support
Chrome 133 (Feb 4, 2025)
Chrome Android 133 (Feb 4, 2025)
Edge 133 (Feb 6, 2025)
Firefox 144 (Oct 14, 2025)
Firefox for Android 144 (Oct 14, 2025)
Safari: not supported
Safari on iOS: not supported
Give us feedback
If you're pressed for time, but you want this feature to be available in all browsers, please give this issue a thumbs up 👍 reaction.
However, a much better guide for us is to know how you'd use this feature, and what you're having to do in the meantime. This helps us judge the priority versus other features.
Copy the template below in a comment, and add the details that matter to you.
## What I want to do with this feature<!-- Add your specific use-cases, even if they seem obvious to you. -->## What I'm having to do in the meantime<!--Are you having to use another feature instead, a polyfill, or is it blocking you completely?Why are the alternatives worse than using this feature?-->
I am currently using this at https://github.com/hackclub/twisted to preserve iFrame loading states when you try moving a window. This makes it so the iFrame doesnt reload every time one of the smaller windows are moved.
What I'm having to do in the meantime
I am currently using a polyfill that re-renders everything every time moveBefore is supposed to be called.
<script>
// MoveBefore polyfill for Safari (suggested by @Luke / U0BFDHWUSPM)
(function () {// 1. Check if the native method is already supportedif(typeofElement.prototype.moveBefore==='function')return;// 2. Define the fallback function matching the moveBefore signatureconstmoveBeforeFallback=function(nodeToMove,referenceNode){if(!nodeToMove){thrownewTypeError("Failed to execute 'moveBefore': 1 argument required, but only 0 present.");}// Element.insertBefore(node, null) behaves exactly like appendChildreturnthis.insertBefore(nodeToMove,referenceNode);};// 3. Apply the fallback across all valid ParentNode prototypesif(typeofElement!=='undefined'){Element.prototype.moveBefore=moveBeforeFallback;}
if (typeof Document !== 'undefined') {Document.prototype.moveBefore=moveBeforeFallback;}
if (typeof DocumentFragment !== 'undefined') {DocumentFragment.prototype.moveBefore=moveBeforeFallback;}})();</script>
Activity
KavyanshKhaitan2 commentedon Sep 19, 2026
What I want to do with this feature
I am currently using this at https://github.com/hackclub/twisted to preserve iFrame loading states when you try moving a window. This makes it so the iFrame doesnt reload every time one of the smaller windows are moved.
What I'm having to do in the meantime
I am currently using a polyfill that re-renders everything every time
moveBeforeis supposed to be called.