LibWeb: Add initial implementation of foreign content parsing

Plus sneak in a FIXME for the list of active formatting elements
and a test for Element.namespaceURI
This commit is contained in:
Luke 2020-10-12 01:51:28 +01:00 committed by Andreas Kling
parent e8a9e8aed5
commit 4e8cb4558b
Notes: sideshowbarker 2024-07-19 01:48:41 +09:00
8 changed files with 304 additions and 106 deletions

View file

@ -21,4 +21,19 @@ afterInitialPageLoad(() => {
how this text
is interpreted below. `);
});
test("Element.namespaceURI basics", () => {
const htmlNamespace = "http://www.w3.org/1999/xhtml";
const p = document.getElementsByTagName("p")[0];
expect(p.namespaceURI).toBe(htmlNamespace);
// createElement always sets the namespace to the HTML namespace in HTML documents.
const svgElement = document.createElement("svg");
expect(svgElement.namespaceURI).toBe(htmlNamespace);
const svgNamespace = "http://www.w3.org/2000/svg";
p.innerHTML = "<svg></svg>";
const domSVGElement = p.getElementsByTagName("svg")[0];
expect(domSVGElement.namespaceURI).toBe(svgNamespace);
});
});