Skip to content

Fix unwanted behavior of NativeString when used with RegExp #11

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

Closed
wants to merge 1 commit into from

Conversation

duonglaiquang
Copy link

@duonglaiquang duonglaiquang commented Jan 4, 2024

This PR does the following:

These tests showcase the buggy behavior of the current implementation.

<!DOCTYPE html>
<html>
<head>
<script>
var regExp = /./;
try {
  console.log("/./".includes(regExp))
} catch (e) {
  console.log(e); // TypeError: First argument to String.prototype.includes must not be a regular expression
  regExp[Symbol.match] = false;
  console.log("/./".includes(regExp)) // expected: true, got TypeError
}
</script>
</head>
<body>
</body>
</html>

@duonglaiquang
Copy link
Author

Move to #12

@duonglaiquang duonglaiquang deleted the duong_string branch January 4, 2024 08:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant