netsurf: factorize document parsing

This commit is contained in:
Pierre Tachoire
2024-02-28 15:15:15 +01:00
parent 25bc2d5e75
commit 63e19c7704
2 changed files with 23 additions and 41 deletions

View File

@@ -460,8 +460,11 @@ pub fn testExecFn(
.{ .src = "let h = document.getElementById('para-empty')", .ex = "undefined" },
.{ .src = "const prev = h.innerHTML", .ex = "undefined" },
.{ .src = "h.innerHTML = '<p>hello world</p>'", .ex = "<p>hello world</p>" },
.{ .src = "h.innerHTML", .ex = "<p>hello world</p>" },
.{ .src = "h.innerHTML = '<p id=\"hello\">hello world</p>'", .ex = "<p id=\"hello\">hello world</p>" },
.{ .src = "h.innerHTML", .ex = "<p id=\"hello\">hello world</p>" },
.{ .src = "h.firstChild.nodeName", .ex = "P" },
.{ .src = "h.firstChild.id", .ex = "hello" },
.{ .src = "h.firstChild.textContent", .ex = "hello world" },
.{ .src = "h.innerHTML = prev; true", .ex = "true" },
.{ .src = "document.getElementById('para-empty').innerHTML.trim()", .ex = "<span id=\"para-empty-child\"></span>" },
};