allow empty/falsy values in v-bind:class array syntax

This commit is contained in:
Evan You 2015-09-27 11:41:44 -04:00
parent b7bc6e663a
commit ab2ff32a88
2 changed files with 5 additions and 1 deletions

View File

@ -32,7 +32,9 @@ module.exports = {
handleArray: function (value) {
this.cleanup(value)
for (var i = 0, l = value.length; i < l; i++) {
addClass(this.el, value[i])
if (value[i]) {
addClass(this.el, value[i])
}
}
this.prevKeys = value
},

View File

@ -47,6 +47,8 @@ if (_.inBrowser) {
expect(el.className).toBe('a c d')
dir.update()
expect(el.className).toBe('a')
dir.update(['e', ''])
expect(el.className).toBe('a e')
})
})