From d2164a194159024dd1700c0e345cc589325a45c3 Mon Sep 17 00:00:00 2001 From: defcc Date: Sat, 10 Dec 2016 20:41:36 +0800 Subject: [PATCH 1/4] reset isProp value --- src/compiler/parser/index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/compiler/parser/index.js b/src/compiler/parser/index.js index e0d44141538..81e0e2e92ba 100644 --- a/src/compiler/parser/index.js +++ b/src/compiler/parser/index.js @@ -414,6 +414,7 @@ function processAttrs (el) { if (bindRE.test(name)) { // v-bind name = name.replace(bindRE, '') value = parseFilters(value) + isProp = false if (modifiers) { if (modifiers.prop) { isProp = true From 5e48758818cb004d2e573db54978e4dddfa3a5af Mon Sep 17 00:00:00 2001 From: defcc Date: Sat, 10 Dec 2016 20:47:57 +0800 Subject: [PATCH 2/4] add test case --- test/unit/features/directives/bind.spec.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/test/unit/features/directives/bind.spec.js b/test/unit/features/directives/bind.spec.js index f9d17a584a9..e2de81d1536 100644 --- a/test/unit/features/directives/bind.spec.js +++ b/test/unit/features/directives/bind.spec.js @@ -121,6 +121,18 @@ describe('Directive v-bind', () => { expect(vm.$el.children[1].innerHTML).toBe('qux') }) + it('.prop modifier with normal attribute bind', () => { + const vm = new Vue({ + template: '', + data: { + some: 'hello', + id: 'world' + } + }).$mount() + expect(vm.$el.some).toBe('hello') + expect(vm.$el.getAttribute('id')).toBe('world') + }) + it('.camel modifier', () => { const vm = new Vue({ template: '', From 1e2d2cde7ff51d711af9fd3286676a48667df1e8 Mon Sep 17 00:00:00 2001 From: defcc Date: Sat, 10 Dec 2016 22:26:08 +0800 Subject: [PATCH 3/4] update test case --- test/unit/features/directives/bind.spec.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/unit/features/directives/bind.spec.js b/test/unit/features/directives/bind.spec.js index e2de81d1536..9f3fcb5e801 100644 --- a/test/unit/features/directives/bind.spec.js +++ b/test/unit/features/directives/bind.spec.js @@ -126,11 +126,11 @@ describe('Directive v-bind', () => { template: '', data: { some: 'hello', - id: 'world' + id: false } }).$mount() expect(vm.$el.some).toBe('hello') - expect(vm.$el.getAttribute('id')).toBe('world') + expect(vm.$el.getAttribute('id')).toBe(null) }) it('.camel modifier', () => { From 9e8ddabfa81f38b72a9e86f45dbb4f9d3ea30837 Mon Sep 17 00:00:00 2001 From: defcc Date: Sat, 10 Dec 2016 22:39:45 +0800 Subject: [PATCH 4/4] fix typo --- test/unit/features/directives/bind.spec.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/unit/features/directives/bind.spec.js b/test/unit/features/directives/bind.spec.js index 9f3fcb5e801..5635778569c 100644 --- a/test/unit/features/directives/bind.spec.js +++ b/test/unit/features/directives/bind.spec.js @@ -121,7 +121,7 @@ describe('Directive v-bind', () => { expect(vm.$el.children[1].innerHTML).toBe('qux') }) - it('.prop modifier with normal attribute bind', () => { + it('.prop modifier with normal attribute binding', () => { const vm = new Vue({ template: '', data: {