Compact style mutation fixes and improvements (#1268)
* Don't use the CSSOM when there's `var()` present as it fails badly https://github.com/rrweb-io/rrweb/pull/1246 * As the CSS Object Model expands out shorthand properties, do a check on the string length before choosing which format to go for - this approach allows 'var()' in a styleOMValue as it's only a problem when combined with a shorthand property - before this change background:black; was getting expaned to 10 OM properties as follows: 'style': { 'background-color': 'black', 'background-image': false, 'background-position-x': false, 'background-position-y': false, 'background-size': false, 'background-repeat-x': false, 'background-repeat-y': false, 'background-attachment': false, 'background-origin': false, 'background-clip': false } * Updates to remainder of tests based on refined compact style mutations * Apply suggestions from code review by: Justin Halsall <Juice10@users.noreply.github.com> --------- Authored-by: eoghanmurray <eoghan@getthere.ie>
This commit is contained in:
@@ -283,7 +283,7 @@ export type textMutation = {
|
||||
value: string | null;
|
||||
};
|
||||
|
||||
export type styleAttributeValue = {
|
||||
export type styleOMValue = {
|
||||
[key: string]: styleValueWithPriority | string | false;
|
||||
};
|
||||
|
||||
@@ -292,13 +292,15 @@ export type styleValueWithPriority = [string, string];
|
||||
export type attributeCursor = {
|
||||
node: Node;
|
||||
attributes: {
|
||||
[key: string]: string | styleAttributeValue | null;
|
||||
[key: string]: string | styleOMValue | null;
|
||||
};
|
||||
styleDiff: styleOMValue;
|
||||
_unchangedStyles: styleOMValue;
|
||||
};
|
||||
export type attributeMutation = {
|
||||
id: number;
|
||||
attributes: {
|
||||
[key: string]: string | styleAttributeValue | null;
|
||||
[key: string]: string | styleOMValue | null;
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user