Skip to content

Commit

Permalink
Add support for SVG <foreignObject>. Fixes #278.
Browse files Browse the repository at this point in the history
  • Loading branch information
developit committed Aug 20, 2016
1 parent 0efa8e8 commit 5550f07
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions src/vdom/diff.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ function idiff(dom, vnode, context, mountAll, rootComponent) {

let out = dom,
nodeName = vnode.nodeName,
svgMode;
prevSvgMode = isSvgMode;

if (isFunction(nodeName)) {
return buildComponentFromVNode(dom, vnode, context, mountAll);
Expand All @@ -81,9 +81,7 @@ function idiff(dom, vnode, context, mountAll, rootComponent) {
nodeName = String(nodeName);
}

svgMode = toLowerCase(nodeName)==='svg';

if (svgMode) isSvgMode = true;
isSvgMode = nodeName==='svg' ? true : nodeName==='foreignObject' ? false : isSvgMode;

if (!dom) {
out = createNode(nodeName, isSvgMode);
Expand All @@ -110,7 +108,7 @@ function idiff(dom, vnode, context, mountAll, rootComponent) {
(out[ATTR_KEY].ref = originalAttributes.ref)(out);
}

if (svgMode) isSvgMode = false;
isSvgMode = prevSvgMode;

return out;
}
Expand Down

0 comments on commit 5550f07

Please sign in to comment.