aboutsummaryrefslogtreecommitdiff
path: root/src/dom/Element.zig
diff options
context:
space:
mode:
Diffstat (limited to 'src/dom/Element.zig')
-rw-r--r--src/dom/Element.zig10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/dom/Element.zig b/src/dom/Element.zig
index 0cbddc4..524586c 100644
--- a/src/dom/Element.zig
+++ b/src/dom/Element.zig
@@ -21,7 +21,7 @@ literal: ?[]const u8 = null,
/// Init a new Element with the given kind.
/// The tag will never be escaped.
-/// The owernship is always taken.
+/// It always duplicates strings.
pub fn init(alloc: Allocator, knd: Kind, tag: []const u8) !Self {
var v = Self{
.kind = knd,
@@ -36,7 +36,7 @@ pub fn init(alloc: Allocator, knd: Kind, tag: []const u8) !Self {
/// Init a new literal element.
/// The literal content will never be escaped, see initLitEscaped if you want to escape it.
-/// The owernship is always taken.
+/// It always duplicates strings.
pub fn initLit(alloc: Allocator, literal: []const u8) !Self {
var v = Self{
.kind = .literal,
@@ -51,7 +51,7 @@ pub fn initLit(alloc: Allocator, literal: []const u8) !Self {
/// Init a new literal element that is escaped.
/// The literal content will be escaped, see initLit if you don't want this behavior.
-/// The owernship is always taken.
+/// It always duplicates strings.
pub fn initLitEscaped(alloc: Allocator, literal: []const u8) !Self {
const escaped = try html.escape(alloc, literal);
defer alloc.free(escaped);
@@ -198,7 +198,7 @@ fn doTest(alloc: Allocator, el: *Self, exp: []const u8) !void {
test "void element" {
var arena = std.heap.DebugAllocator(.{}).init;
- defer _ = arena.deinit();
+ defer if (arena.deinit() == .leak) std.debug.print("leaking!\n", .{});
const alloc = arena.allocator();
var br = try init(alloc, .void, "br");
@@ -220,7 +220,7 @@ test "void element" {
test "content element" {
var arena = std.heap.DebugAllocator(.{}).init;
- defer _ = arena.deinit();
+ defer if (arena.deinit() == .leak) std.debug.print("leaking!\n", .{});
const alloc = arena.allocator();
var p = try init(alloc, .content, "p");