@@ -465,17 +465,17 @@ export class CssProperty<T extends Style, U> implements definitions.CssProperty<
465465
466466 const property = this ;
467467
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 ;
470471 if ( reset ) {
471472 value = defaultValue ;
472473 delete this [ sourceKey ] ;
473- }
474- else {
474+ } else {
475475 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 ;
479479 }
480480
481481 const oldValue : U = key in this ? this [ key ] : defaultValue ;
@@ -533,22 +533,23 @@ export class CssProperty<T extends Style, U> implements definitions.CssProperty<
533533 }
534534 }
535535
536- function setCssValue ( this : T , value : U ) : void {
537- const reset = value === unsetValue ;
536+ function setCssValue ( this : T , newValue : U | string ) : void {
538537 const currentValueSource : number = this [ sourceKey ] || ValueSource . Default ;
539538
540539 // We have localValueSource - NOOP.
541540 if ( currentValueSource === ValueSource . Local ) {
542541 return ;
543542 }
544543
544+ const reset = newValue === unsetValue || newValue === "" ;
545+ let value : U ;
545546 if ( reset ) {
546547 value = defaultValue ;
547548 delete this [ sourceKey ] ;
548549 } else {
549- if ( valueConverter && typeof value === "string" ) {
550- value = valueConverter ( value ) ;
551- }
550+ value = valueConverter && typeof newValue === "string" ?
551+ valueConverter ( newValue ) :
552+ < U > newValue ;
552553 this [ sourceKey ] = ValueSource . Css ;
553554 }
554555
@@ -716,13 +717,14 @@ export class CssAnimationProperty<T extends Style, U> implements definitions.Css
716717 return {
717718 enumerable, configurable,
718719 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 ) {
720721
721722 const oldValue = this [ computedValue ] ;
722723 const oldSource = this [ computedSource ] ;
723724 const wasSet = oldSource !== ValueSource . Default ;
724-
725- if ( boxedValue === unsetValue ) {
725+ const reset = boxedValue === unsetValue || boxedValue === "" ;
726+
727+ if ( reset ) {
726728 this [ symbol ] = unsetValue ;
727729 if ( this [ computedSource ] === propertySource ) {
728730 // Fallback to lower value source.
@@ -856,7 +858,7 @@ export class InheritedCssProperty<T extends Style, U> extends CssProperty<T, U>
856858 const property = this ;
857859
858860 const setFunc = ( valueSource : ValueSource ) => function ( this : T , boxedValue : any ) : void {
859- const reset = boxedValue === unsetValue ;
861+ const reset = boxedValue === unsetValue || boxedValue === "" ;
860862 const currentValueSource : number = this [ sourceKey ] || ValueSource . Default ;
861863 if ( reset ) {
862864 // If we want to reset cssValue and we have localValue - return;
@@ -1309,4 +1311,4 @@ export function getComputedCssValues(view: ViewBase): [string, any][] {
13091311 result . push ( [ "bottom" , "auto" ] ) ;
13101312 result . push ( [ "right" , "auto" ] ) ;
13111313 return result ;
1312- }
1314+ }
0 commit comments