File tree Expand file tree Collapse file tree 2 files changed +21
-8
lines changed Expand file tree Collapse file tree 2 files changed +21
-8
lines changed Original file line number Diff line number Diff line change @@ -8,8 +8,9 @@ function camelReplacer (m) {
88module . exports = {
99
1010 bind : function ( ) {
11- var prop = this . arg ,
12- first = prop . charAt ( 0 )
11+ var prop = this . arg
12+ if ( ! prop ) return
13+ var first = prop . charAt ( 0 )
1314 if ( first === '$' ) {
1415 // properties that start with $ will be auto-prefixed
1516 prop = prop . slice ( 1 )
@@ -23,13 +24,17 @@ module.exports = {
2324
2425 update : function ( value ) {
2526 var prop = this . prop
26- this . el . style [ prop ] = value
27- if ( this . prefixed ) {
28- prop = prop . charAt ( 0 ) . toUpperCase ( ) + prop . slice ( 1 )
29- var i = prefixes . length
30- while ( i -- ) {
31- this . el . style [ prefixes [ i ] + prop ] = value
27+ if ( prop ) {
28+ this . el . style [ prop ] = value
29+ if ( this . prefixed ) {
30+ prop = prop . charAt ( 0 ) . toUpperCase ( ) + prop . slice ( 1 )
31+ var i = prefixes . length
32+ while ( i -- ) {
33+ this . el . style [ prefixes [ i ] + prop ] = value
34+ }
3235 }
36+ } else {
37+ this . el . style . cssText = value
3338 }
3439 }
3540
Original file line number Diff line number Diff line change @@ -730,6 +730,14 @@ describe('UNIT: Directives', function () {
730730 assert . strictEqual ( d . el . style . msTransform , val )
731731 } )
732732
733+ it ( 'should set cssText if no arg' , function ( ) {
734+ var d = mockDirective ( 'style' )
735+ d . bind ( )
736+ var val = 'color:#fff'
737+ d . update ( val )
738+ assert . strictEqual ( d . el . style . color , 'rgb(255, 255, 255)' )
739+ } )
740+
733741 } )
734742
735743 describe ( 'cloak' , function ( ) {
You can’t perform that action at this time.
0 commit comments