(node, async, fn)
| 263 | }); |
| 264 | |
| 265 | function detach(node, async, fn) { |
| 266 | var parent = node.parentNode, |
| 267 | next = node.nextSibling; |
| 268 | // No parent node? Abort! |
| 269 | if (!parent) { |
| 270 | return; |
| 271 | } |
| 272 | // Detach node from DOM. |
| 273 | parent.removeChild(node); |
| 274 | // Handle case where optional `async` argument is omitted. |
| 275 | if (typeof async !== 'boolean') { |
| 276 | fn = async; |
| 277 | async = false; |
| 278 | } |
| 279 | // Note that if a function wasn't passed, the node won't be re-attached! |
| 280 | if (fn && async) { |
| 281 | // If async == true, reattach must be called manually. |
| 282 | fn.call(node, reattach); |
| 283 | } else if (fn) { |
| 284 | // If async != true, reattach will happen automatically. |
| 285 | fn.call(node); |
| 286 | reattach(); |
| 287 | } |
| 288 | // Re-attach node to DOM. |
| 289 | function reattach() { |
| 290 | parent.insertBefore(node, next); |
| 291 | } |
| 292 | } |
no test coverage detected
searching dependent graphs…