|
@@ -72,7 +72,14 @@ export default class Styles {
|
|
|
*/
|
|
*/
|
|
|
setStyle( styleString = '' ) {
|
|
setStyle( styleString = '' ) {
|
|
|
this.clear();
|
|
this.clear();
|
|
|
- this._parseStyle( styleString );
|
|
|
|
|
|
|
+
|
|
|
|
|
+ const map = parseInlineStyles( styleString );
|
|
|
|
|
+
|
|
|
|
|
+ for ( const key of map.keys() ) {
|
|
|
|
|
+ const value = map.get( key );
|
|
|
|
|
+
|
|
|
|
|
+ this._parseProperty( key, value );
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -147,19 +154,19 @@ export default class Styles {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
getInlineProperty( name ) {
|
|
getInlineProperty( name ) {
|
|
|
- const model = this.getNormalized( name );
|
|
|
|
|
|
|
+ const normalized = this.getNormalized( name );
|
|
|
|
|
|
|
|
- if ( !model ) {
|
|
|
|
|
|
|
+ if ( !normalized ) {
|
|
|
// Try return directly
|
|
// Try return directly
|
|
|
return this._styles[ name ];
|
|
return this._styles[ name ];
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- if ( isObject( model ) ) {
|
|
|
|
|
- return toInlineStyle( name, model, true );
|
|
|
|
|
|
|
+ if ( isObject( normalized ) ) {
|
|
|
|
|
+ return toInlineStyle( name, normalized, true );
|
|
|
}
|
|
}
|
|
|
// String value
|
|
// String value
|
|
|
else {
|
|
else {
|
|
|
- return model;
|
|
|
|
|
|
|
+ return normalized;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -173,16 +180,6 @@ export default class Styles {
|
|
|
this._styles = {};
|
|
this._styles = {};
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- _parseStyle( string ) {
|
|
|
|
|
- const map = parseInlineStyles( string );
|
|
|
|
|
-
|
|
|
|
|
- for ( const key of map.keys() ) {
|
|
|
|
|
- const value = map.get( key );
|
|
|
|
|
-
|
|
|
|
|
- this._parseProperty( key, value );
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
_appendStyleValue( nameOrPath, valueOrObject ) {
|
|
_appendStyleValue( nameOrPath, valueOrObject ) {
|
|
|
if ( typeof valueOrObject === 'object' ) {
|
|
if ( typeof valueOrObject === 'object' ) {
|
|
|
if ( nameOrPath.includes( '.' ) ) {
|
|
if ( nameOrPath.includes( '.' ) ) {
|