[Webkit-unassigned] [Bug 266866] New: Dash character in character range breaks <input> pattern regex

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Sun Dec 24 09:48:30 PST 2023


https://bugs.webkit.org/show_bug.cgi?id=266866

            Bug ID: 266866
           Summary: Dash character in character range breaks <input>
                    pattern regex
           Product: WebKit
           Version: Safari 17
          Hardware: Mac (Apple Silicon)
                OS: macOS 14
            Status: NEW
          Severity: Major
          Priority: P2
         Component: Forms
          Assignee: webkit-unassigned at lists.webkit.org
          Reporter: webkit at ian.timothy.to
                CC: cdumez at apple.com, wenson_hsieh at apple.com

OVERVIEW

When the regex of a <input> pattern contains a character range with a actual dash character (not a range operator), the validation for the form element is always true. Dash characters recognized as range operators are not an issue (like: [0-9]), only dash characters recognized as an actual character in a set (like: [0-9-]).

This is a regression because it works as expected on older versions.

Is similar to, if not same as:
https://github.com/GoogleChrome/chromium-dashboard/issues/3106


STEPS TO REPRODUCE

i = document.createElement('input');
i.value = 'asdf';

i.pattern = '^[0-9-]{4}$';
v1 = i.checkValidity();   // returns true instead of false

i.pattern = '^[0-9]{4}$';
v2 = i.checkValidity();   // returns false as expected

console.log(v1, v2);


ACTUAL RESULTS

Safari 17:
true - false

Safari 15:
false - false


EXPECTED RESULTS

false - false

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20231224/0f7af3f1/attachment-0001.htm>


More information about the webkit-unassigned mailing list