File tree Expand file tree Collapse file tree 2 files changed +19
-1
lines changed Expand file tree Collapse file tree 2 files changed +19
-1
lines changed Original file line number Diff line number Diff line change 1
1
import { parseTemplate } from '../parsers/template'
2
+ import { parseText } from '../parsers/text'
2
3
import {
3
4
warn ,
4
5
isTemplate ,
@@ -149,7 +150,7 @@ function mergeAttrs (from, to) {
149
150
value = attrs [ i ] . value
150
151
if ( ! to . hasAttribute ( name ) && ! specialCharRE . test ( name ) ) {
151
152
to . setAttribute ( name , value )
152
- } else if ( name === 'class' ) {
153
+ } else if ( name === 'class' && ! parseText ( value ) ) {
153
154
value . split ( / \s + / ) . forEach ( function ( cls ) {
154
155
addClass ( to , cls )
155
156
} )
Original file line number Diff line number Diff line change @@ -428,4 +428,21 @@ describe('Misc', function () {
428
428
} )
429
429
expect ( vm . $el . firstChild . className ) . toBe ( 'hi test-transition' )
430
430
} )
431
+
432
+ it ( 'transclude class merging should skip interpolated class' , function ( ) {
433
+ var vm = new Vue ( {
434
+ el : document . createElement ( 'div' ) ,
435
+ template : '<test class="outer-{{test}}"></test>' ,
436
+ data : {
437
+ test : 'hi'
438
+ } ,
439
+ components : {
440
+ test : {
441
+ template : '<div class="inner"></div>' ,
442
+ replace : true
443
+ }
444
+ }
445
+ } )
446
+ expect ( vm . $el . firstChild . className ) . toBe ( 'outer-hi' )
447
+ } )
431
448
} )
You can’t perform that action at this time.
0 commit comments