Skip to content
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

fix: Fix Safari 10–13 sticky regular expression quirks #15

Merged
merged 5 commits into from
Jun 5, 2023

Conversation

kitten
Copy link
Member

@kitten kitten commented Jun 5, 2023

Resolves #14

Summary

This resolves quirks that occur with Safari 10–13’s implementation of sticky regular expressions. It may not be a comprehensive fix, nor do I have an explanation for this.

The following regular expressions seem to match/test positively, when they shouldn't:

/null|true|false/y;
/(?:\.\d+)?(?:[eE][+-]?\d+)?/y;
/query|mutation|subscription/y;

The last one in this list actually doesn't, which further confuses me.
Either way, they can all be fixed by slightly rewriting them.

Set of changes

  • Wrap constRe's pattern in a non-capturing group
  • Wrap operationDefinitionRe's pattern in a non-capturing group
  • Rewrite floatPartRe's pattern to strictly always be non-empty
  • UNRELATED: Update word patterns to use \w more sparingly and accurately

@kitten kitten merged commit 1b2e92b into main Jun 5, 2023
@kitten kitten deleted the fix/safari-regexp-quirk branch June 5, 2023 20:57
@github-actions github-actions bot mentioned this pull request Jun 5, 2023
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.

Incorrect parse behaviour on older versions of iOS (12/13/14)
1 participant