fix svg across component boundaries
This commit is contained in:
parent
7b268c6ee8
commit
ca784a684e
6 changed files with 64 additions and 75 deletions
|
|
@ -40,12 +40,7 @@ function hyperscript(selector) {
|
|||
if (children instanceof Array && children.length == 1 && children[0] != null && children[0].tag === "#") text = children[0].children
|
||||
else childList = children
|
||||
|
||||
var vnode = Node(tag || "div", attrs.key, hasAttrs ? attrs : undefined, childList, text, undefined)
|
||||
switch (vnode.tag) {
|
||||
case "svg": changeNS("http://www.w3.org/2000/svg", vnode); break
|
||||
case "math": changeNS("http://www.w3.org/1998/Math/MathML", vnode); break
|
||||
}
|
||||
return vnode
|
||||
return Node(tag || "div", attrs.key, hasAttrs ? attrs : undefined, childList, text, undefined)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -68,11 +63,4 @@ function hyperscript(selector) {
|
|||
return Node(selector, attrs && attrs.key, attrs || {}, Node.normalizeChildren(children), undefined, undefined)
|
||||
}
|
||||
|
||||
function changeNS(ns, vnode) {
|
||||
vnode.ns = ns
|
||||
if (vnode.children != null) {
|
||||
for (var i = 0; i < vnode.children.length; i++) changeNS(ns, vnode.children[i])
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = hyperscript
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue