mirror of
https://github.com/odoo/owl.git
synced 2025-10-06 19:59:41 +07:00
[FIX] blockdom: do not propagate svg namespace to siblings
This commit is contained in:
committed by
Aaron Bohy
parent
463eb4bb86
commit
5dddf8f9a3
@@ -127,7 +127,7 @@ function buildTree(
|
|||||||
switch (node.nodeType) {
|
switch (node.nodeType) {
|
||||||
case Node.ELEMENT_NODE: {
|
case Node.ELEMENT_NODE: {
|
||||||
// HTMLElement
|
// HTMLElement
|
||||||
let currentNS = parent && parent.currentNS;
|
let currentNS = domParentTree && domParentTree.currentNS;
|
||||||
const tagName = (node as Element).tagName;
|
const tagName = (node as Element).tagName;
|
||||||
let el: Node | undefined = undefined;
|
let el: Node | undefined = undefined;
|
||||||
const info: DynamicInfo[] = [];
|
const info: DynamicInfo[] = [];
|
||||||
|
|||||||
@@ -243,6 +243,22 @@ describe("misc", () => {
|
|||||||
expect(fixture.innerHTML).toBe(`<a hello="world"><b><c>12</c></b>3</a>`);
|
expect(fixture.innerHTML).toBe(`<a hello="world"><b><c>12</c></b>3</a>`);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test("namespace is not propagated to siblings", () => {
|
||||||
|
const block = createBlock(`<div><svg block-ns="someNameSpace"><g/></svg><div></div></div>`);
|
||||||
|
|
||||||
|
const fixture = makeTestFixture();
|
||||||
|
mount(block(), fixture);
|
||||||
|
|
||||||
|
expect(fixture.innerHTML).toBe("<div><svg><g></g></svg><div></div></div>");
|
||||||
|
expect(fixture.querySelector("svg")!.namespaceURI).toBe("someNameSpace");
|
||||||
|
expect(fixture.querySelector("g")!.namespaceURI).toBe("someNameSpace");
|
||||||
|
const allDivs = fixture.querySelectorAll("div");
|
||||||
|
expect(Array.from(allDivs).map((el) => el.namespaceURI)).toEqual([
|
||||||
|
"http://www.w3.org/1999/xhtml",
|
||||||
|
"http://www.w3.org/1999/xhtml",
|
||||||
|
]);
|
||||||
|
});
|
||||||
|
|
||||||
// test.skip("reusing a block skips patching process", async () => {
|
// test.skip("reusing a block skips patching process", async () => {
|
||||||
// const block = createBlock('<div><block-text-0/></div>');
|
// const block = createBlock('<div><block-text-0/></div>');
|
||||||
// const foo = block(["foo"]);
|
// const foo = block(["foo"]);
|
||||||
|
|||||||
Reference in New Issue
Block a user