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:
9
.changeset/clean-plants-play.md
Normal file
9
.changeset/clean-plants-play.md
Normal file
@@ -0,0 +1,9 @@
|
||||
---
|
||||
'rrweb': patch
|
||||
'@rrweb/types': patch
|
||||
---
|
||||
|
||||
Compact style mutation fixes and improvements
|
||||
|
||||
- fixes when style updates contain a 'var()' on a shorthand property #1246
|
||||
- further ensures that style mutations are compact by reverting to string method if it is shorter
|
||||
Reference in New Issue
Block a user