Skip to content

Commit

Permalink
Merge branch 'master' into fix/heatmap-resize
Browse files Browse the repository at this point in the history
  • Loading branch information
benjackwhite authored Apr 24, 2024
2 parents 0846f10 + b4cea12 commit 4ddbee5
Show file tree
Hide file tree
Showing 2 changed files with 60 additions and 36 deletions.
90 changes: 57 additions & 33 deletions patches/[email protected]
Original file line number Diff line number Diff line change
Expand Up @@ -489,41 +489,65 @@ index 0d49411b1f6d31103bed898c0e81d1d74ab51234..0b2160ef08aa3ae5310f63c295abc0a5
}
applyMutation(d, isSync) {
diff --git a/es/rrweb/packages/rrweb-snapshot/es/rrweb-snapshot.js b/es/rrweb/packages/rrweb-snapshot/es/rrweb-snapshot.js
index 38a23aaae8d683fa584329eced277dd8de55d1ff..44efee95395f6612204e051724a108833741a492 100644
index 38a23aaae8d683fa584329eced277dd8de55d1ff..1090307f2974c2eb6259d650fd02ef2e2c40e790 100644
--- a/es/rrweb/packages/rrweb-snapshot/es/rrweb-snapshot.js
+++ b/es/rrweb/packages/rrweb-snapshot/es/rrweb-snapshot.js
@@ -1271,15 +1271,22 @@ function parse(css, options = {}) {
.replace(/"(?:\\"|[^"])*"|'(?:\\'|[^'])*'/g, (m) => {
return m.replace(/,/g, '\u200C');
@@ -1255,54 +1255,15 @@ function parse(css, options = {}) {
});
- return customSplit(cleanedInput).map((s) => s.replace(/\u200C/g, ',').trim());
+ return cleanedInput.split(/\s*(?![^(]*\)),\s*/).map((s) => s.replace(/\u200C/g, ',').trim());
}
function customSplit(input) {
const result = [];
let currentSegment = '';
let depthParentheses = 0;
let depthBrackets = 0;
+ let currentStringChar = null;
for (const char of input) {
function selector() {
- whitespace();
- while (css[0] == '}') {
- error('extra closing bracket');
- css = css.slice(1);
- whitespace();
- }
- const m = match(/^(("(?:\\"|[^"])*"|'(?:\\'|[^'])*'|[^{])+)/);
+ const m = match(/^([^{]+)/);
if (!m) {
return;
}
- const cleanedInput = m[0]
- .trim()
+ return trim(m[0])
.replace(/\/\*([^*]|[\r\n]|(\*+([^*/]|[\r\n])))*\*\/+/g, '')
.replace(/"(?:\\"|[^"])*"|'(?:\\'|[^'])*'/g, (m) => {
- return m.replace(/,/g, '\u200C');
- });
- return customSplit(cleanedInput).map((s) => s.replace(/\u200C/g, ',').trim());
- }
- function customSplit(input) {
- const result = [];
- let currentSegment = '';
- let depthParentheses = 0;
- let depthBrackets = 0;
- for (const char of input) {
- if (char === '(') {
+ const hasStringEscape = currentSegment.endsWith('\\');
+ if (currentStringChar) {
+ if (currentStringChar === char && !hasStringEscape) {
+ currentStringChar = null;
+ }
+ }
+ else if (char === '(') {
depthParentheses++;
}
else if (char === ')') {
@@ -1291,6 +1298,9 @@ function parse(css, options = {}) {
else if (char === ']') {
depthBrackets--;
}
+ else if ('\'"'.includes(char)) {
+ currentStringChar = char;
+ }
if (char === ',' && depthParentheses === 0 && depthBrackets === 0) {
result.push(currentSegment);
currentSegment = '';
- depthParentheses++;
- }
- else if (char === ')') {
- depthParentheses--;
- }
- else if (char === '[') {
- depthBrackets++;
- }
- else if (char === ']') {
- depthBrackets--;
- }
- if (char === ',' && depthParentheses === 0 && depthBrackets === 0) {
- result.push(currentSegment);
- currentSegment = '';
- }
- else {
- currentSegment += char;
- }
- }
- if (currentSegment) {
- result.push(currentSegment);
- }
- return result;
+ return m.replace(/,/g, '\u200C');
+ });
}
function declaration() {
const pos = position();
6 changes: 3 additions & 3 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 4ddbee5

Please sign in to comment.