File tree Expand file tree Collapse file tree 2 files changed +17
-1
lines changed Expand file tree Collapse file tree 2 files changed +17
-1
lines changed Original file line number Diff line number Diff line change @@ -152,7 +152,7 @@ function mergeAttrs (from, to) {
152
152
if ( ! to . hasAttribute ( name ) && ! specialCharRE . test ( name ) ) {
153
153
to . setAttribute ( name , value )
154
154
} else if ( name === 'class' && ! parseText ( value ) ) {
155
- value . split ( / \s + / ) . forEach ( function ( cls ) {
155
+ value . trim ( ) . split ( / \s + / ) . forEach ( function ( cls ) {
156
156
addClass ( to , cls )
157
157
} )
158
158
}
Original file line number Diff line number Diff line change @@ -473,4 +473,20 @@ describe('Misc', function () {
473
473
} )
474
474
expect ( vm . $el . textContent ) . toBe ( 'default content slot1' )
475
475
} )
476
+
477
+ // #2426
478
+ it ( 'class merge untrimmed' , function ( ) {
479
+ expect ( function ( ) {
480
+ new Vue ( {
481
+ el : document . createElement ( 'div' ) ,
482
+ template : '<test class="p1 p2 "></test>' ,
483
+ components : {
484
+ test : {
485
+ template : '<div class="hi"></div>' ,
486
+ replace : true
487
+ }
488
+ }
489
+ } )
490
+ } ) . not . toThrow ( )
491
+ } )
476
492
} )
You can’t perform that action at this time.
0 commit comments