File tree 2 files changed +21
-8
lines changed
2 files changed +21
-8
lines changed Original file line number Diff line number Diff line change @@ -8,8 +8,9 @@ function camelReplacer (m) {
8
8
module . exports = {
9
9
10
10
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 )
13
14
if ( first === '$' ) {
14
15
// properties that start with $ will be auto-prefixed
15
16
prop = prop . slice ( 1 )
@@ -23,13 +24,17 @@ module.exports = {
23
24
24
25
update : function ( value ) {
25
26
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
+ }
32
35
}
36
+ } else {
37
+ this . el . style . cssText = value
33
38
}
34
39
}
35
40
Original file line number Diff line number Diff line change @@ -730,6 +730,14 @@ describe('UNIT: Directives', function () {
730
730
assert . strictEqual ( d . el . style . msTransform , val )
731
731
} )
732
732
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
+
733
741
} )
734
742
735
743
describe ( 'cloak' , function ( ) {
You can’t perform that action at this time.
0 commit comments