Skip to content

Commit

Permalink
Begone ye camelCase
Browse files Browse the repository at this point in the history
  • Loading branch information
eoghanmurray committed Jan 10, 2025
1 parent 0e812f9 commit ec2da5c
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions packages/rrweb-snapshot/src/rebuild.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ export function applyCssSplits(
if (hackCss) {
adaptedCss = adaptCssForReplay(cssTextSplits.join(''), cache);
}
let ix_start = 0;
let startIndex = 0;
for (let i = 0; i < childTextNodes.length; i++) {
if (i === cssTextSplits.length) {
break;
Expand All @@ -115,31 +115,31 @@ export function applyCssSplits(
if (!hackCss) {
childTextNode.textContent = cssTextSplits[i];
} else if (i < childTextNodes.length - 1) {
let ix_end = ix_start;
let end_search = cssTextSplits[i + 1].length;
let endIndex = startIndex;
let endSearch = cssTextSplits[i + 1].length;

// don't do hundreds of searches, in case a mismatch
// is caused close to start of string
end_search = Math.min(end_search, 30);
endSearch = Math.min(endSearch, 30);

let found = false;
for (; end_search > 2; end_search--) {
let search_bit = cssTextSplits[i + 1].substring(0, end_search);
let search_ix = adaptedCss.substring(ix_start).indexOf(search_bit);
found = search_ix !== -1;
for (; endSearch > 2; endSearch--) {
let searchBit = cssTextSplits[i + 1].substring(0, endSearch);

Check failure on line 127 in packages/rrweb-snapshot/src/rebuild.ts

View workflow job for this annotation

GitHub Actions / ESLint Check and Report Upload

'searchBit' is never reassigned. Use 'const' instead
let searchIndex = adaptedCss.substring(startIndex).indexOf(searchBit);

Check failure on line 128 in packages/rrweb-snapshot/src/rebuild.ts

View workflow job for this annotation

GitHub Actions / ESLint Check and Report Upload

'searchIndex' is never reassigned. Use 'const' instead
found = searchIndex !== -1;
if (found) {
ix_end += search_ix;
endIndex += searchIndex;
break;
}
}
if (!found) {
// something went wrong, put a similar sized chunk in the right place
ix_end += cssTextSplits[i].length;
endIndex += cssTextSplits[i].length;
}
childTextNode.textContent = adaptedCss.substring(ix_start, ix_end);
ix_start = ix_end;
childTextNode.textContent = adaptedCss.substring(startIndex, endIndex);
startIndex = endIndex;
} else {
childTextNode.textContent = adaptedCss.substring(ix_start);
childTextNode.textContent = adaptedCss.substring(startIndex);
}
}
}
Expand Down

0 comments on commit ec2da5c

Please sign in to comment.