@@ -465,17 +465,17 @@ export class CssProperty<T extends Style, U> implements definitions.CssProperty<
465
465
466
466
const property = this ;
467
467
468
- function setLocalValue ( this : T , value : U ) : void {
469
- const reset = value === unsetValue ;
468
+ function setLocalValue ( this : T , newValue : U | string ) : void {
469
+ const reset = newValue === unsetValue || newValue === "" ;
470
+ let value : U ;
470
471
if ( reset ) {
471
472
value = defaultValue ;
472
473
delete this [ sourceKey ] ;
473
- }
474
- else {
474
+ } else {
475
475
this [ sourceKey ] = ValueSource . Local ;
476
- if ( valueConverter && typeof value === "string" ) {
477
- value = valueConverter ( value ) ;
478
- }
476
+ value = ( valueConverter && typeof newValue === "string" ) ?
477
+ valueConverter ( newValue ) :
478
+ < U > newValue ;
479
479
}
480
480
481
481
const oldValue : U = key in this ? this [ key ] : defaultValue ;
@@ -533,22 +533,23 @@ export class CssProperty<T extends Style, U> implements definitions.CssProperty<
533
533
}
534
534
}
535
535
536
- function setCssValue ( this : T , value : U ) : void {
537
- const reset = value === unsetValue ;
536
+ function setCssValue ( this : T , newValue : U | string ) : void {
538
537
const currentValueSource : number = this [ sourceKey ] || ValueSource . Default ;
539
538
540
539
// We have localValueSource - NOOP.
541
540
if ( currentValueSource === ValueSource . Local ) {
542
541
return ;
543
542
}
544
543
544
+ const reset = newValue === unsetValue || newValue === "" ;
545
+ let value : U ;
545
546
if ( reset ) {
546
547
value = defaultValue ;
547
548
delete this [ sourceKey ] ;
548
549
} else {
549
- if ( valueConverter && typeof value === "string" ) {
550
- value = valueConverter ( value ) ;
551
- }
550
+ value = valueConverter && typeof newValue === "string" ?
551
+ valueConverter ( newValue ) :
552
+ < U > newValue ;
552
553
this [ sourceKey ] = ValueSource . Css ;
553
554
}
554
555
@@ -716,13 +717,14 @@ export class CssAnimationProperty<T extends Style, U> implements definitions.Css
716
717
return {
717
718
enumerable, configurable,
718
719
get : getsComputed ? function ( this : T ) { return this [ computedValue ] ; } : function ( this : T ) { return this [ symbol ] ; } ,
719
- set ( this : T , boxedValue : U ) {
720
+ set ( this : T , boxedValue : U | string ) {
720
721
721
722
const oldValue = this [ computedValue ] ;
722
723
const oldSource = this [ computedSource ] ;
723
724
const wasSet = oldSource !== ValueSource . Default ;
724
-
725
- if ( boxedValue === unsetValue ) {
725
+ const reset = boxedValue === unsetValue || boxedValue === "" ;
726
+
727
+ if ( reset ) {
726
728
this [ symbol ] = unsetValue ;
727
729
if ( this [ computedSource ] === propertySource ) {
728
730
// Fallback to lower value source.
@@ -856,7 +858,7 @@ export class InheritedCssProperty<T extends Style, U> extends CssProperty<T, U>
856
858
const property = this ;
857
859
858
860
const setFunc = ( valueSource : ValueSource ) => function ( this : T , boxedValue : any ) : void {
859
- const reset = boxedValue === unsetValue ;
861
+ const reset = boxedValue === unsetValue || boxedValue === "" ;
860
862
const currentValueSource : number = this [ sourceKey ] || ValueSource . Default ;
861
863
if ( reset ) {
862
864
// If we want to reset cssValue and we have localValue - return;
@@ -1309,4 +1311,4 @@ export function getComputedCssValues(view: ViewBase): [string, any][] {
1309
1311
result . push ( [ "bottom" , "auto" ] ) ;
1310
1312
result . push ( [ "right" , "auto" ] ) ;
1311
1313
return result ;
1312
- }
1314
+ }
0 commit comments