ladybird/Tests/LibWeb/Text/input/HTML/DOMParser-parseFromString-document-url.html
Andreas Kling 55f58eea99 LibWeb: Use the correct document URL in DOMParser.parseFromString()
We were hard-coding "about:blank" as the document URL for parsed HTML
documents, which was definitely not correct.

This fixes a bunch of WPT tests under /domparsing/ :^)
2024-10-17 19:16:08 +02:00

19 lines
650 B
HTML

<script src="../include.js"></script>
<script>
test(() => {
const parser = new DOMParser();
for (const mimeType of ["text/html", "application/xhtml+xml"]) {
const doc = parser.parseFromString("<html><b>hello", mimeType);
if (doc.URL == "about:blank") {
println("FAIL 1 " + mimeType);
} else if (!doc.URL.endsWith(".html")) {
println("FAIL 2 " + mimeType);
} else if (doc.URL == document.URL) {
println("PASS " + mimeType);
} else {
println("FAIL 3 " + mimeType);
}
}
});
</script>