Skip to content

Commit

Permalink
Fix the RegExp flag used for input pattern validation
Browse files Browse the repository at this point in the history
According to MDN (https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/pattern#overview),
the RegExp flag was changed from 'u' to 'v' around mid-2023, so jsdom
should update to match that.
  • Loading branch information
stnguyen90 committed Feb 9, 2024
1 parent 2f8a730 commit 280c2af
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/jsdom/living/nodes/HTMLInputElement-impl.js
Original file line number Diff line number Diff line change
Expand Up @@ -1025,8 +1025,8 @@ class HTMLInputElementImpl extends HTMLElementImpl {
// The pattern attribute should be matched against the entire value, not just any
// subset, so add ^ and $ anchors. But also check the validity of the regex itself
// first.
new RegExp(pattern, "u"); // eslint-disable-line no-new
regExp = new RegExp("^(?:" + pattern + ")$", "u");
new RegExp(pattern, "v"); // eslint-disable-line no-new
regExp = new RegExp("^(?:" + pattern + ")$", "v");
} catch (e) {
return false;
}
Expand Down

0 comments on commit 280c2af

Please sign in to comment.