From a13df3ca580dc31544ef092d5d37e18089af3517 Mon Sep 17 00:00:00 2001 From: Anhgelus Morhtuuzh Date: Thu, 30 Apr 2026 17:56:55 +0200 Subject: refactor(element): generalize element creation --- src/eval/html/Void.zig | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/eval/html/Void.zig') diff --git a/src/eval/html/Void.zig b/src/eval/html/Void.zig index 431536c..17b369d 100644 --- a/src/eval/html/Void.zig +++ b/src/eval/html/Void.zig @@ -30,7 +30,7 @@ pub fn init(alloc: Allocator, tag: []const u8) Error!*Self { } pub fn element(self: *Self) Element { - return (Element.Wrapper(Self){ .ptr = self }).element(); + return Element.Wrapper(Self, render).init(self); } pub fn setAttribute(self: *Self, k: []const u8, v: []const u8) Error!void { @@ -62,7 +62,7 @@ fn fromNode(context: *anyopaque) Element { return self.element(); } -pub fn render(self: *Self, alloc: Allocator) Error![]const u8 { +fn render(self: *Self, alloc: Allocator) Error![]const u8 { const attr = try renderAttribute(alloc, &self.attributes, &self.class_list); defer if (attr) |it| alloc.free(it); var acc = try List(u8).initCapacity(alloc, self.tag.len + 2); -- cgit v1.2.3