Skip to content

Commit 28e4065

Browse files
Merge pull request #606 from lightpanda-io/no_owned_slice
remove unecessary toOwnedSlice
2 parents 540dea9 + e44388b commit 28e4065

File tree

1 file changed

+2
-10
lines changed

1 file changed

+2
-10
lines changed

src/browser/dom/element.zig

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -103,22 +103,14 @@ pub const Element = struct {
103103

104104
pub fn get_innerHTML(self: *parser.Element, state: *SessionState) ![]const u8 {
105105
var buf = std.ArrayList(u8).init(state.arena);
106-
defer buf.deinit();
107-
108106
try dump.writeChildren(parser.elementToNode(self), buf.writer());
109-
// TODO express the caller owned the slice.
110-
// https://github.com/lightpanda-io/jsruntime-lib/issues/195
111-
return buf.toOwnedSlice();
107+
return buf.items;
112108
}
113109

114110
pub fn get_outerHTML(self: *parser.Element, state: *SessionState) ![]const u8 {
115111
var buf = std.ArrayList(u8).init(state.arena);
116-
defer buf.deinit();
117-
118112
try dump.writeNode(parser.elementToNode(self), buf.writer());
119-
// TODO express the caller owned the slice.
120-
// https://github.com/lightpanda-io/jsruntime-lib/issues/195
121-
return buf.toOwnedSlice();
113+
return buf.items;
122114
}
123115

124116
pub fn set_innerHTML(self: *parser.Element, str: []const u8) !void {

0 commit comments

Comments
 (0)