Explorar o código

auto remove from document

ncannasse %!s(int64=6) %!d(string=hai) anos
pai
achega
574292c416
Modificáronse 1 ficheiros con 6 adicións e 0 borrados
  1. 6 0
      h2d/domkit/InitComponents.hx

+ 6 - 0
h2d/domkit/InitComponents.hx

@@ -23,6 +23,12 @@ class InitComponents {
 						super.onRemove();
 						var style = Std.instance(document.style, h2d.domkit.Style);
 						if( style != null ) @:privateAccess style.remove(this);
+						// make sure it's also removed from document
+						var elt = document.get(this);
+						if( elt != null && elt.parent != null ) {
+							elt.parent.children.remove(elt);
+							@:privateAccess elt.parent = null;
+						}
 					}
 				}).fields);
 				break;