Skip to content

Commit

Permalink
fix: inherit SVG ns on component root node (vuejs#6511)
Browse files Browse the repository at this point in the history
  • Loading branch information
javoski authored and ztlevi committed Feb 14, 2018
1 parent 7065f11 commit d852244
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/core/vdom/create-element.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ export function _createElement (
let vnode, ns
if (typeof tag === 'string') {
let Ctor
ns = config.getTagNamespace(tag)
ns = (context.$vnode && context.$vnode.ns) || config.getTagNamespace(tag)
if (config.isReservedTag(tag)) {
// platform built-in elements
vnode = new VNode(
Expand Down
18 changes: 18 additions & 0 deletions test/unit/modules/vdom/create-element.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,24 @@ describe('create-element', () => {
expect(vnode.children[0].children[0].ns).toBeUndefined()
})

// #6506
it('render SVGAElement in a component correctly', () => {
const vm = new Vue({
template: `
<svg>
<test></test>
</svg>
`,
components: {
test: { render: h => h('a') }
}
}).$mount()
const testComp = vm.$children[0]
expect(testComp.$vnode.ns).toBe('svg')
expect(testComp._vnode.tag).toBe('a')
expect(testComp._vnode.ns).toBe('svg')
})

it('warn observed data objects', () => {
new Vue({
data: {
Expand Down

0 comments on commit d852244

Please sign in to comment.