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

Normalize regex testing when using the new ES6 regex flags. #1274

Closed
wants to merge 1 commit into from

Conversation

ariya
Copy link
Contributor

@ariya ariya commented Aug 8, 2015

On an environment that already supports the new ES6 regex flags,
the regex value won't be null. This causes the test to be mistakenly
marked as a failure since the baseline has the null value.

To workaround this, ensure that regex value is always null when using
the new ES6 regex flags. Other comparisons will still happen to ensure
that the regex is handled properly.

Fixes #1271.

@mathiasbynens
Copy link
Contributor

LGTM.

@jasonLaster
Copy link
Contributor

LG


// Nullify regex value for ES6 regex flags
if (key === 'value' && o.hasOwnProperty('regex')) {
if ('uy'.indexOf(o.regex.flags) >= 0) {
Copy link
Contributor

Choose a reason for hiding this comment

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

  1. This will only work if there's a single flag or if the flags are exactly uy, in that order.
  2. Why have this line at all? Just omit any regexp values when the node has a regex field.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm hesitant to completely ignore the regex object for everything else, since there is a value doing that. I agree on the limited scope of the check, I'll expand it to account for cases whenever u or y is present.

On an environment that already supports the new ES6 regex flags,
the regex value won't be null. This causes the test to be mistakenly
marked as a failure since the baseline has the null value.

To workaround this, ensure that regex value is always null when using
the new ES6 regex flags. Other comparisons will still happen to ensure
that the regex is handled properly.

Fixes jquery#1271.
@ariya ariya closed this in d81f033 Aug 9, 2015
@ariya ariya deleted the normalize-regex branch August 12, 2015 18:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants