Skip to content

Commit

Permalink
prevented possible RegExp#split problems in old engines, close #751,
Browse files Browse the repository at this point in the history
…close #919, thanks @Khartir
  • Loading branch information
zloirock committed Apr 7, 2021
1 parent 9b4274f commit 49da8b7
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 5 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
@@ -1,5 +1,6 @@
## Changelog
##### Unreleased
- Prevented possible `RegExp#split` problems in old engines, [#751](https://github.com/zloirock/core-js/issues/751), [#919](https://github.com/zloirock/core-js/issues/919)
- Detection of Safari 10 string padding bug extended to some Safari-based browsers

##### 3.10.0 - 2021.03.31
Expand Down
Expand Up @@ -4,7 +4,6 @@ require('../modules/es.regexp.exec');
var redefine = require('../internals/redefine');
var fails = require('../internals/fails');
var wellKnownSymbol = require('../internals/well-known-symbol');
var regexpExec = require('../internals/regexp-exec');
var createNonEnumerableProperty = require('../internals/create-non-enumerable-property');

var SPECIES = wellKnownSymbol('species');
Expand Down Expand Up @@ -95,7 +94,7 @@ module.exports = function (KEY, length, exec, sham) {
) {
var nativeRegExpMethod = /./[SYMBOL];
var methods = exec(SYMBOL, ''[KEY], function (nativeMethod, regexp, str, arg2, forceStringMethod) {
if (regexp.exec === regexpExec) {
if (regexp.exec === RegExp.prototype.exec) {
if (DELEGATES_TO_SYMBOL && !forceStringMethod) {
// The native String method already delegates to @@method (this
// polyfilled function), leasing to infinite recursion.
Expand Down
3 changes: 0 additions & 3 deletions packages/core-js/internals/regexp-exec.js
Expand Up @@ -4,9 +4,6 @@ var stickyHelpers = require('./regexp-sticky-helpers');
var shared = require('./shared');

var nativeExec = RegExp.prototype.exec;
// This always refers to the native implementation, because the
// String#replace polyfill uses ./fix-regexp-well-known-symbol-logic.js,
// which loads this file before patching the method.
var nativeReplace = shared('native-string-replace', String.prototype.replace);

var patchedExec = nativeExec;
Expand Down

0 comments on commit 49da8b7

Please sign in to comment.