From e54cdbfeff5958a11c7191ae8b5ce41e735d512b Mon Sep 17 00:00:00 2001 From: Andries Hiemstra Date: Thu, 12 May 2022 09:21:50 +0200 Subject: [PATCH] see #22, replaceChild --- src/modules/htmldom/mod.rs | 39 +++++++++++++++++++++++++++++++++++++- 1 file changed, 38 insertions(+), 1 deletion(-) diff --git a/src/modules/htmldom/mod.rs b/src/modules/htmldom/mod.rs index 29d3da68a23..064a8b2c944 100644 --- a/src/modules/htmldom/mod.rs +++ b/src/modules/htmldom/mod.rs @@ -409,7 +409,7 @@ fn init_node_proxy(realm: &R) -> Result(realm: &R) -> Result Err(JsError::new_str("Node was not an Element")), + Some(_element) => { + old_child.insert_before(new_child); + old_child.detach(); + let _ = old_child.parent().take(); + Ok(args[1].clone()) + } + }) + }) .add_method("createElement", |_rt, realm, id, args| { //