diff --git a/src/puppygirl/__init__.py b/src/puppygirl/__init__.py index 0198dd9..04475f6 100644 --- a/src/puppygirl/__init__.py +++ b/src/puppygirl/__init__.py @@ -14,11 +14,6 @@ class Clonable[T = Self](Protocol): def clone(self) -> T: return copy(self) -def to_element(value: ElementLike) -> "Element": - if isinstance(value, Element): - return value - return Element(value) - # tag names PgSlotName = "puppygirl-slot" TemplateName = "template" @@ -42,6 +37,11 @@ class Element(Clonable): self.value = value + def from_element_like(value: ElementLike) -> Self: + if isinstance(value, Element): + return value + return Element(value) + def clone(self) -> Self: return Element(copy(self.value)) @@ -195,7 +195,3 @@ class Puppygirl: tag.replace_with(new_tag) return tree - -pg = Puppygirl([PuppygirlSlot]) -tree = pg.fetch("mdn.html") -print(tree.prettify())