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

Firefox until 78 support \p, Is there any good solution? #343

Closed
SCWR opened this issue Apr 18, 2022 · 3 comments
Closed

Firefox until 78 support \p, Is there any good solution? #343

SCWR opened this issue Apr 18, 2022 · 3 comments

Comments

@SCWR
Copy link

SCWR commented Apr 18, 2022

I found itsues and found that \p introduced may be because of this #228.
\p Start support is 2018
But Firefox is only supported until 78 (2020).
What is the way to block the use of \p
Need to be compatible with Firefox 67 in my use scenario.
image

/\(\?P?<([\p{ID_Start}$_][\p{ID_Continue}$_\u200C\u200D]*)>/u,

@SCWR SCWR changed the title Firefox Until 78 support \p, Is there any good solution? Firefox until 78 support \p, Is there any good solution? Apr 18, 2022
@slevithan
Copy link
Owner

What is the issue you've encountered?

You're making some assumptions about browser support here that do not seem relevant. XRegExp has supported \p{...} for matching Unicode categories, etc. for something like 14 years now (before JS regex syntax supported it natively), going back to at least Firefox 3.

@SCWR
Copy link
Author

SCWR commented Apr 20, 2022

For my scenario, I need compatibility with Firefox 67

Then I use the xregexp base ability to do forward matching. That's your example https://gist.github.com/slevithan/2387872

This line is executed when using the XRegexp base capability

/\(\?P?<([\p{ID_Start}$_][\p{ID_Continue}$_\u200C\u200D]*)>/u,

However, Firefox needs to be upgraded above 78 to support \p{...}

https://caniuse.com/?search=%5Cp

Whether the above functions are required

If not, is it possible to make a plug-in

Base capabilities are one package, others are loaded on demand

By the way, I solved this problem by tweaking compatible versions

@slevithan
Copy link
Owner

Ah, now I see what you mean. That line you highlighted in xregexp.js gets translated automatically by babel-plugin-transform-xregexp when generating xregexp-all.js. You could modify the build script if you wanted to not include all the plugins while still using Babel to do this transformation. You could also use any XRegExp version prior to v5.0.0 (where this line was added to support an extended set of capture name characters as part of #247) to get around this.

If not, is it possible to make a plug-in

Base capabilities are one package, others are loaded on demand

Yes, I'm open to this and would be happy to see pull requests that show how this might be achieved.

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

No branches or pull requests

2 participants