Pantelis Peslis 10 anos atrás
pai
commit
8f3d4f7465

+ 2 - 6
src/compiler/compile.js

@@ -658,12 +658,8 @@ function compileDirectives (attrs, options) {
     // attribute interpolations
     // attribute interpolations
     if (tokens) {
     if (tokens) {
       value = tokensToExp(tokens)
       value = tokensToExp(tokens)
-      if (name === 'class') {
-        pushDir('class', internalDirectives['class'], true)
-      } else {
-        arg = name
-        pushDir('bind', publicDirectives.bind, true)
-      }
+      arg = name
+      pushDir('bind', publicDirectives.bind, true)
       // warn against mixing mustaches with v-bind
       // warn against mixing mustaches with v-bind
       if (process.env.NODE_ENV !== 'production') {
       if (process.env.NODE_ENV !== 'production') {
         if (name === 'class' && Array.prototype.some.call(attrs, function (attr) {
         if (name === 'class' && Array.prototype.some.call(attrs, function (attr) {

+ 3 - 3
test/unit/specs/compiler/compile_spec.js

@@ -509,19 +509,19 @@ describe('Compile', function () {
   it('attribute interpolation', function (done) {
   it('attribute interpolation', function (done) {
     var vm = new Vue({
     var vm = new Vue({
       el: el,
       el: el,
-      template: '<div id="{{a}}" class="b {{c}} d"></div>',
+      template: '<div id="{{a}}" class="b bla-{{c}} d"></div>',
       data: {
       data: {
         a: 'aaa',
         a: 'aaa',
         c: 'ccc'
         c: 'ccc'
       }
       }
     })
     })
     expect(el.firstChild.id).toBe('aaa')
     expect(el.firstChild.id).toBe('aaa')
-    expect(el.firstChild.className).toBe('b d ccc')
+    expect(el.firstChild.className).toBe('b bla-ccc d')
     vm.a = 'aa'
     vm.a = 'aa'
     vm.c = 'cc'
     vm.c = 'cc'
     _.nextTick(function () {
     _.nextTick(function () {
       expect(el.firstChild.id).toBe('aa')
       expect(el.firstChild.id).toBe('aa')
-      expect(el.firstChild.className).toBe('b d cc')
+      expect(el.firstChild.className).toBe('b bla-cc d')
       done()
       done()
     })
     })
   })
   })

+ 1 - 1
test/unit/specs/misc_spec.js

@@ -414,6 +414,6 @@ describe('Misc', function () {
         }
         }
       }
       }
     })
     })
-    expect(vm.$el.firstChild.getAttribute('class')).toBe('si-icon abc def')
+    expect(vm.$el.firstChild.getAttribute('class')).toBe('si-icon def abc')
   })
   })
 })
 })