Skip to content

Commit 4373165

Browse files
committed
Removes node from DOM, executes callback, and inserts block back into DOM
1 parent 0df2f24 commit 4373165

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

exec_out_of_dom.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
function exec_out_of_dom (node, callback) {
2+
var papa,
3+
next_sibling;
4+
5+
papa = node.parentNode;
6+
next_sibling = node.nextSibling;
7+
papa.removeChild(node);
8+
callback();
9+
if (next_sibling) {
10+
papa.inserBefore(node, next_sibling);
11+
} else {
12+
papa.appendChild(node);
13+
}
14+
}

0 commit comments

Comments
 (0)