Visitar URL original
Sticky RegExp 'y' and RegExp#test delegation by alinhle · Pull Request #732 · zloirock/core-js · GitHub
Skip to content

Sticky RegExp 'y' and RegExp#test delegation - #732

Merged
zloirock merged 5 commits into
zloirock:masterfrom
alinhle:sticky-regexp
Dec 17, 2019
Merged

zloirock merged 5 commits into
zloirock:masterfrom
alinhle:sticky-regexp

Conversation

@alinhle

@alinhle alinhle commented Dec 17, 2019 •

Copy link
Copy Markdown
Contributor

This PR implements the sticky flag for Regular Expressions and RegExp#test delegation to RegExp#exec. It is based on the stale PR from @nicolo-ribaudo (many thanks!!) #492.

Changes include:

Tested in a multitude of browser versions using BrowserStack starting from the minimum supported versions of core-js.

My goal was to make https://github.com/projectfluent/fluent.js work in IE11, which I've successfully verified! (also don't forget to use a different markup parser for those trying the same: https://gist.github.com/cvle/67b69517b7d3e83f5de9ccace270415c).

@zloirock

Copy link
Copy Markdown
Owner

Since it works only for the global version, need to add empty files with similar names to packages/core-js-pure/overwrite.

RegExpWrapper
);

if (UNSUPPORTED_Y) setInternalState(result, { sticky: sticky });

@zloirock zloirock Dec 17, 2019 •

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe it would be better to set it only when sticky is true?


module.exports = function (it) {
return it.sticky;
};

@zloirock zloirock Dec 17, 2019 •

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also required stable/regexp/sticky, features/regexp/sticky, the same for RegExp#test and adding them to tests/commonjs.

@zloirock

Copy link
Copy Markdown
Owner

I think I'll fix it by myself. Thanks!

@zloirock
zloirock merged commit 80d7bfe into zloirock:master Dec 17, 2019
zloirock added a commit that referenced this pull request Dec 17, 2019
@nicolo-ribaudo

Copy link
Copy Markdown
Contributor

Thanks @cvle for working on my PR, and @zloirock for the quick fixes!

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.

3 participants