Skip to content

Commit 5a0cb20

Browse files
authored
Merge pull request #24 from pendo-io/ajax-revert-grid-template-pr
Revert grid template prs
2 parents 6321c05 + 1340c80 commit 5a0cb20

File tree

2 files changed

+1
-49
lines changed

2 files changed

+1
-49
lines changed

.changeset/stale-llamas-divide.md

-5
This file was deleted.

packages/rrweb-snapshot/src/utils.ts

+1-44
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,7 @@ export function getNative<T>(
6262

6363
export const nativeSetTimeout =
6464
typeof window !== 'undefined'
65-
? (getNative<typeof window.setTimeout>('setTimeout').bind(
66-
window,
67-
) as typeof window.setTimeout)
65+
? getNative<typeof window.setTimeout>('setTimeout').bind(window)
6866
: global.setTimeout;
6967

7068
/**
@@ -159,44 +157,6 @@ export function stringifyStylesheet(s: CSSStyleSheet): string | null {
159157
}
160158
}
161159

162-
function replaceChromeGridTemplateAreas(rule: CSSStyleRule): string {
163-
const hasGridTemplateInCSSText = rule.cssText.includes('grid-template:');
164-
const hasGridTemplateAreaInStyleRules =
165-
rule.style.getPropertyValue('grid-template-areas') !== '';
166-
const hasGridTemplateAreaInCSSText = rule.cssText.includes(
167-
'grid-template-areas:',
168-
);
169-
if (
170-
isCSSStyleRule(rule) &&
171-
hasGridTemplateInCSSText &&
172-
hasGridTemplateAreaInStyleRules &&
173-
!hasGridTemplateAreaInCSSText
174-
) {
175-
// chrome does not correctly provide the grid template areas in the rules cssText
176-
// e.g. https://bugs.chromium.org/p/chromium/issues/detail?id=1303968
177-
// we remove the grid-template rule from the text... so everything from grid-template: to the next semicolon
178-
// and then add each grid-template-x rule into the css text because Chrome isn't doing this correctly
179-
const parts = rule.cssText
180-
.split(';')
181-
.filter((s) => !s.includes('grid-template:'))
182-
.map((s) => s.trim());
183-
184-
const gridStyles: string[] = [];
185-
186-
for (let i = 0; i < rule.style.length; i++) {
187-
const styleName = rule.style[i];
188-
if (styleName.startsWith('grid-template')) {
189-
gridStyles.push(
190-
`${styleName}: ${rule.style.getPropertyValue(styleName)}`,
191-
);
192-
}
193-
}
194-
parts.splice(parts.length - 1, 0, gridStyles.join('; '));
195-
return parts.join('; ');
196-
}
197-
return rule.cssText;
198-
}
199-
200160
export function stringifyRule(rule: CSSRule, sheetHref: string | null): string {
201161
if (isCSSImportRule(rule)) {
202162
let importStringified;
@@ -222,9 +182,6 @@ export function stringifyRule(rule: CSSRule, sheetHref: string | null): string {
222182
// see https://bugs.webkit.org/show_bug.cgi?id=184604
223183
ruleStringified = fixSafariColons(ruleStringified);
224184
}
225-
if (isCSSStyleRule(rule)) {
226-
ruleStringified = replaceChromeGridTemplateAreas(rule);
227-
}
228185
if (sheetHref) {
229186
return absolutifyURLs(ruleStringified, sheetHref);
230187
}

0 commit comments

Comments
 (0)