Skip to content

Commit 03043b9

Browse files
committed
support .camel modifier
1 parent 0458e2e commit 03043b9

File tree

3 files changed

+21
-6
lines changed

3 files changed

+21
-6
lines changed

src/compiler/parser/index.js

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -391,10 +391,15 @@ function processAttrs (el) {
391391
if (bindRE.test(name)) { // v-bind
392392
name = name.replace(bindRE, '')
393393
value = parseFilters(value)
394-
if (modifiers && modifiers.prop) {
395-
isProp = true
396-
name = camelize(name)
397-
if (name === 'innerHtml') name = 'innerHTML'
394+
if (modifiers) {
395+
if (modifiers.prop) {
396+
isProp = true
397+
name = camelize(name)
398+
if (name === 'innerHtml') name = 'innerHTML'
399+
}
400+
if (modifiers.camel) {
401+
name = camelize(name)
402+
}
398403
}
399404
if (isProp || platformMustUseProp(el.tag, name)) {
400405
addProp(el, name, value)

test/unit/features/component/component-scoped-slot.spec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import Vue from 'vue'
22

3-
fdescribe('Component scoped slot', () => {
3+
describe('Component scoped slot', () => {
44
it('default slot', done => {
55
const vm = new Vue({
66
template: `

test/unit/features/directives/bind.spec.js

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ describe('Directive v-bind', () => {
109109
}).then(done)
110110
})
111111

112-
it('bind as prop', () => {
112+
it('.prop modifier', () => {
113113
const vm = new Vue({
114114
template: '<div><span v-bind:text-content.prop="foo"></span><span :inner-html.prop="bar"></span></div>',
115115
data: {
@@ -121,6 +121,16 @@ describe('Directive v-bind', () => {
121121
expect(vm.$el.children[1].innerHTML).toBe('<span>qux</span>')
122122
})
123123

124+
it('.camel modifier', () => {
125+
const vm = new Vue({
126+
template: '<svg :view-box.camel="viewBox"></svg>',
127+
data: {
128+
viewBox: '0 0 1 1'
129+
}
130+
}).$mount()
131+
expect(vm.$el.getAttribute('viewBox')).toBe('0 0 1 1')
132+
})
133+
124134
it('bind object', done => {
125135
const vm = new Vue({
126136
template: '<input v-bind="test">',

0 commit comments

Comments
 (0)