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
Re-merge maze loop trap #22970
Re-merge maze loop trap #22970
Conversation
@@ -764,3 +764,7 @@ export function calculateOffsetCoordinates(element, clientX, clientY) { | |||
y: Math.round((clientY - rect.top) * element.offsetHeight / rect.height), | |||
}; | |||
} | |||
|
|||
export function escapeRegExp(str) { | |||
return str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"); |
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.
Huh, do special characters not need to be escaped when in a character set?
0b041c5
to
2615d1e
Compare
1b4b803
to
7e7970f
Compare
@@ -48,7 +48,7 @@ exports.strip = function (code) { | |||
// Strip out serial numbers. | |||
.replace(/(,\s*)?'block_id_\d+'\)/g, ')') | |||
// Remove timeouts. | |||
.replace(INFINITE_LOOP_TRAP, '') | |||
.replace(new RegExp(utils.escapeRegExp(INFINITE_LOOP_TRAP), 'g'), '') |
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.
Coming soon to babel, replaceAll
for this exact use case! https://twitter.com/v8js/status/1193917549060280320
Revert PR #22860, to re-merge PR #22752 (with fixes).