Skip to content

Commit 51725cf

Browse files
committed
fix SVG foreignObject (fix vuejs#4122)
1 parent 5d36e8b commit 51725cf

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

src/core/vdom/create-element.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,9 @@ function _createElement (
5555
// unknown or unlisted namespaced elements
5656
// check at runtime because it may get assigned a namespace when its
5757
// parent normalizes children
58+
const childNs = tag === 'foreignObject' ? 'xhtml' : ns
5859
return new VNode(
59-
tag, data, normalizeChildren(children, ns),
60+
tag, data, normalizeChildren(children, childNs),
6061
undefined, undefined, ns, context
6162
)
6263
}

src/platforms/web/util/element.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@ import { makeMap } from 'shared/util'
55

66
export const namespaceMap = {
77
svg: 'http://www.w3.org/2000/svg',
8-
math: 'http://www.w3.org/1998/Math/MathML'
8+
math: 'http://www.w3.org/1998/Math/MathML',
9+
xhtml: 'http://www.w3.org/1999/xhtm'
910
}
1011

1112
export const isHTMLTag = makeMap(

0 commit comments

Comments
 (0)