File tree 1 file changed +12
-2
lines changed
packages/rrweb-snapshot/src
1 file changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -1008,7 +1008,10 @@ export function serializeNodeWithId(
1008
1008
id = genId ( ) ;
1009
1009
}
1010
1010
1011
- const serializedNode = Object . assign ( _serializedNode , { id } ) ;
1011
+ const serializedNode : serializedNode & {
1012
+ id : number ;
1013
+ rrwebAdoptedStylesheets ?: Array < string | null > ;
1014
+ } = Object . assign ( _serializedNode , { id } ) ;
1012
1015
// add IGNORED_NODE to mirror to track nextSiblings
1013
1016
mirror . add ( n , serializedNode ) ;
1014
1017
@@ -1025,8 +1028,15 @@ export function serializeNodeWithId(
1025
1028
// this property was not needed in replay side
1026
1029
delete serializedNode . needBlock ;
1027
1030
const shadowRootEl = dom . shadowRoot ( n ) ;
1028
- if ( shadowRootEl && isNativeShadowDom ( shadowRootEl ) )
1031
+ if ( shadowRootEl && isNativeShadowDom ( shadowRootEl ) ) {
1029
1032
serializedNode . isShadowHost = true ;
1033
+ if ( shadowRootEl . adoptedStyleSheets . length > 0 ) {
1034
+ serializedNode . rrwebAdoptedStylesheets =
1035
+ shadowRootEl . adoptedStyleSheets . map ( ( stylesheet ) =>
1036
+ stringifyStylesheet ( stylesheet ) ,
1037
+ ) ;
1038
+ }
1039
+ }
1030
1040
}
1031
1041
if (
1032
1042
( serializedNode . type === NodeType . Document ||
You can’t perform that action at this time.
0 commit comments