Added support for overriding xml namespace.

It was required to allow embedding HTML foreignObjects inside SVG
This commit is contained in:
Sergey Kirillov 2014-05-24 22:28:02 +03:00
parent c4e13384db
commit 9b1ccc7981
2 changed files with 7 additions and 3 deletions

View file

@ -66,7 +66,8 @@ Mithril = m = new function app(window) {
if (typeof data.tag != "string") return
var node, isNew = cached.nodes.length === 0
if (data.tag === "svg") namespace = "http://www.w3.org/2000/svg"
if (data.attrs.xmlns) namespace = data.attrs.xmlns
else if (data.tag === "svg") namespace = "http://www.w3.org/2000/svg"
if (isNew) {
node = namespace === undefined ? window.document.createElement(data.tag) : window.document.createElementNS(namespace, data.tag)
cached = {