mirror of
https://github.com/odoo/owl.git
synced 2025-10-06 19:59:41 +07:00
[FIX] qweb: support of svg in t-raw
Before this commit, t-raw a string containing `<svg>` did not display the svg element. This was because of missing namespace in vnode's data. Now, `vdom.addNS` is called to add the svg namespace when necessary.
This commit is contained in:
committed by
Géry Debongnie
parent
85318b3ae6
commit
9fd8315c53
@@ -1,4 +1,4 @@
|
||||
import { VNode, h } from "./vdom";
|
||||
import { VNode, h, addNS } from "./vdom";
|
||||
|
||||
const parser = new DOMParser();
|
||||
|
||||
@@ -23,5 +23,9 @@ function htmlToVNode(node: ChildNode): VNode {
|
||||
for (let c of node.childNodes) {
|
||||
children.push(htmlToVNode(c));
|
||||
}
|
||||
return h((node as Element).tagName, { attrs }, children);
|
||||
const vnode = h((node as Element).tagName, { attrs }, children);
|
||||
if (vnode.sel === "svg") {
|
||||
addNS(vnode.data, (vnode as any).children, vnode.sel);
|
||||
}
|
||||
return vnode;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user