mirror of
https://github.com/lightpanda-io/browser.git
synced 2025-10-30 15:41:48 +00:00
browser: update document parse signature
This commit is contained in:
@@ -208,7 +208,7 @@ pub const Page = struct {
|
|||||||
// https://html.spec.whatwg.org/#read-html
|
// https://html.spec.whatwg.org/#read-html
|
||||||
fn loadHTMLDoc(self: *Page, result: *FetchResult) !void {
|
fn loadHTMLDoc(self: *Page, result: *FetchResult) !void {
|
||||||
log.debug("parse html", .{});
|
log.debug("parse html", .{});
|
||||||
const html_doc = try parser.documentHTMLParseFromStrAlloc(self.allocator, result.body.?);
|
const html_doc = try parser.documentHTMLParseFromStr(result.body.?);
|
||||||
const doc = parser.documentHTMLToDocument(html_doc);
|
const doc = parser.documentHTMLToDocument(html_doc);
|
||||||
|
|
||||||
// save a document's pointer in the page.
|
// save a document's pointer in the page.
|
||||||
|
|||||||
@@ -83,7 +83,10 @@ fn nodeFile(root: *parser.Element, out: File) !void {
|
|||||||
|
|
||||||
// HTMLFileTestFn is run by run_tests.zig
|
// HTMLFileTestFn is run by run_tests.zig
|
||||||
pub fn HTMLFileTestFn(out: File) !void {
|
pub fn HTMLFileTestFn(out: File) !void {
|
||||||
const doc_html = try parser.documentHTMLParseFromFileAlloc(std.testing.allocator, "test.html");
|
const file = try std.fs.cwd().openFile("test.html", .{});
|
||||||
|
defer file.close();
|
||||||
|
|
||||||
|
const doc_html = try parser.documentHTMLParse(file.reader());
|
||||||
// ignore close error
|
// ignore close error
|
||||||
defer parser.documentHTMLClose(doc_html) catch {};
|
defer parser.documentHTMLClose(doc_html) catch {};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user