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 b699527
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 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
2 changes: 0 additions & 2 deletions test/web-platform-tests/to-run.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1107,7 +1107,6 @@ formaction.html: [fail, Unknown]

DIR: html/semantics/forms/constraints

form-validation-validity-patternMismatch.html: [fail, Unknown]
form-validation-validity-valueMissing.html: [fail, 'Spec unclear (see https://github.com/whatwg/html/issues/5202)']
form-validation-willValidate.html:
"[INPUT in COLOR status] Must be barred from the constraint validation if it is readonly": [fail, Not implemented]
Expand Down Expand Up @@ -1190,7 +1189,6 @@ input-type-button.html: [fail, Depends on offsetWidth]
input-type-change-value.html: [fail, Unknown]
input-type-checkbox-switch.tentative.window.html: [fail, Unknown]
input-untrusted-key-event.html: [fail-slow, Not implemented]
pattern_attribute_v_flag.html: [fail, Unknown]
radio-disconnected-group-owner.html: [fail, Unknown]
range-2.html: [fail, step attribute not yet implemented]
range-restore-oninput-onchange-event.https.html: [fail-slow, Not implemented]
Expand Down

0 comments on commit b699527

Please sign in to comment.