@@ -270,7 +270,7 @@ export function createPatchFunction (backend) {
createElm(children[i], insertedVnodeQueue, vnode.elm, null, true)
}
} else if (isPrimitive(vnode.text)) {
- nodeOps.appendChild(vnode.elm, nodeOps.createTextNode(vnode.text))
+ nodeOps.appendChild(vnode.elm, nodeOps.createTextNode(String(vnode.text)))
@@ -27,6 +27,8 @@ export function isPrimitive (value: any): boolean %checks {
return (
typeof value === 'string' ||
typeof value === 'number' ||
+ // $flow-disable-line
+ typeof value === 'symbol' ||
typeof value === 'boolean'
)
@@ -215,6 +215,15 @@ describe('create-element', () => {
expect('Avoid using non-primitive value as key').not.toHaveBeenWarned()
})
+ it('doesn\'t warn symbol key', () => {
+ new Vue({
+ render (h) {
+ return h('div', { key: Symbol('symbol') })
+ }
+ }).$mount()
+ expect('Avoid using non-primitive value as key').not.toHaveBeenWarned()
+ })
+
it('nested child elements should be updated correctly', done => {
const vm = new Vue({
data: { n: 1 },