-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Single style capture #1437
base: master
Are you sure you want to change the base?
Single style capture #1437
Conversation
🦋 Changeset detectedLatest commit: 938aeea The changes in this PR will be included in the next version bump. This PR includes changesets to release 8 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
3ea2885
to
1d59339
Compare
fa37bfa
to
0c875be
Compare
@@ -463,6 +465,7 @@ function serializeNode( | |||
recordCanvas, | |||
keepIframeSrcFn, | |||
newlyAddedElement = false, | |||
blankTextNodes = false, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This addition is to prevent extra 'reading' of the textContent, while still generating an id
for the text node.
However, if there's multiple text node children on the <style> we still will have to 'read' the textContent in findCssTextSplits
47f542b
to
6210356
Compare
// support legacy style | ||
return doc.createTextNode(adaptCssForReplay(n.textContent, cache)); | ||
} | ||
return doc.createTextNode(n.textContent); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This diff is intended to be functionally the same, but rewritten to show that the isStyle
marker is no longer expected
f5f1bde
to
ee6c028
Compare
\\"attributes\\": { | ||
\\"_cssText\\": \\"div { color: red; }section { color: blue; }\\", | ||
\\"_cssTextSplits\\": \\"19 43\\" | ||
}, | ||
\\"childNodes\\": [ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So @Juice10 I think you had a question here about why I am moving things up to _cssText
and adding _cssTextSplits
rather than just storing everything in the childNodes ...
I suppose the "real reason" is that in the asset version of this code, we don't have the _cssText
or _cssTextSplits
attributes at all, but instead get these later as part of the asset event. So with the asset version, we are avoiding the inclusion of the css text content twice (in terms of size of total recording).
0c7403e
to
1b71bc3
Compare
[key: string]: string | number | true | null; | ||
type cssTextKeyAttr = { | ||
_cssText?: string; | ||
_cssTextSplits?: string; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change is to ensure that if these two are defined that they can't be number/boolean/null (typescript was complaining without this)
58b031d
to
746dfbd
Compare
2fcf2fb
to
02f4fcb
Compare
… checking the replay took me ages to debug as I thought it was something I introducedg
… mutations with `absoluteToStylesheet` - I had accidentally removed that with initial work
…yStylesheet to happen in a single place during initial snapshot.
…tyle> need to be tracked
…n't being assigned to correct text node, and provide remedy whereby css text is properly re-split upon rebuild
…our there and some explanatory comments
…hat the css hasn't been altered server-side/in-transit
… second text child instead of the first
…ion, even if there is only one text element on the <style>. Recent conversation with Justin has firmed up my thinking on why we look at .sheet in the first place (it's not because we want to get rid of vendor prefixes, which may actually be undesirable where they are useful for accurate replay in the replayer - but rather it's to ensure we don't miss any programmatic style mutations that have happened - have added comments to reflect this)
rrweb:test: test/utils.ts:181:43 - error TS2345: Argument of type 'elementNode & { rootId?: number | undefined; isShadowHost?: boolean | undefined; isShadow?: boolean | undefined; } & { id: number; }' is not assignable to parameter of type '{ attributes: { src?: string | undefined; }; }'. rrweb:test: Types of property 'attributes' are incompatible. rrweb:test: Type 'attributes' has no properties in common with type '{ src?: string | undefined; }'. rrweb:test: rrweb:test: 181 stripBlobURLsFromAttributes(add.node);
54fc502
to
938aeea
Compare
Prep PR for async <style> serialization via assets: refactor stringifyStylesheet to happen in a single place during initial snapshot.
blankTextNodes