Incorrect pattern attribute parsing
Categories
(Core :: DOM: Core & HTML, defect)
Tracking
()
Tracking | Status | |
---|---|---|
thunderbird_esr115 | --- | unaffected |
firefox-esr102 | --- | unaffected |
firefox-esr115 | --- | unaffected |
firefox116 | --- | wontfix |
firefox117 | --- | wontfix |
firefox118 | --- | wontfix |
People
(Reporter: jarvisa62, Unassigned)
References
(Regression)
Details
(Keywords: regression, regressionwindow-wanted)
Attachments
(1 file)
503 bytes,
text/html
|
Details |
User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/116.0
Steps to reproduce:
Open the attached file in the FireFox.
Press F12 to launch the developer tools.
Go to the ‘Console’ tab.
Actual results:
The script invokes RegExp.test on some sample strings using the pattern in the <input> element.
These tests produce the expected results, however the console window is showing the error:
Unable to check <input pattern='^[+-]?\d+$'> because the pattern is not a valid regexp: invalid character in class in regular expression
Expected results:
The pattern attribute does not accept the ‘-’ that is not part of a range expression, although this is allowed by the specification.
https://tc39.es/ecma262/multipage/text-processing.html#sec-regexp-regular-expression-objects
‘NonemptyClassRanges’ can be ‘ClassAtom NonemptyClassRangesNoDash’
‘NonemptyClassRangesNoDash’ can be ‘ClassAtom’
‘ClassAtom’ can be ‘-’
This was broken fairly recently. I noticed validation problems maybe a few weeks ago but only investigated today.
Why is the pattern attribute using a different parser to the RegExp object?
Comment 1•1 year ago
|
||
The Bugbug bot thinks this bug should belong to the 'Core::DOM: Core & HTML' component, and is moving the bug to that component. Please correct in case you think the bot is wrong.
Comment 2•1 year ago
•
|
||
regexp showing expected output, but console showing error - > Reclassify to DEvTools: Console.
Comment 3•1 year ago
|
||
This is not a DevTools issue, the console is only showing the error message sent by the platform.
I can reproduce on release, and the error message wasn't there on ESR 102
Updated•1 year ago
|
Comment 4•1 year ago
|
||
Regression window:
https://hg.mozilla.org/integration/autoland/pushloghtml?fromchange=f40526ad71128696c2b791893a2f16489d6856f2&tochange=ff49b7e10326016b065b25c2c59c3222a363b292
Updated•1 year ago
|
Comment 5•1 year ago
|
||
Set release status flags based on info from the regressing bug 1814870
:peterv, since you are the author of the regressor, bug 1814870, could you take a look? Also, could you set the severity field?
For more information, please visit BugBot documentation.
Comment 6•1 year ago
|
||
(In reply to Andrew Jarvis from comment #0)
Why is the pattern attribute using a different parser to the RegExp object?
The pattern attribute uses RegExpCreate(pattern, "v")
(see step 3 in https://html.spec.whatwg.org/#the-pattern-attribute). You'll need to pass v
to the RegExp
constructor if you want to use it with a pattern
attribute's value, and the pattern
attribute's value needs to use v-mode character classes (see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Regular_expressions/Character_class#v-mode_character_class).
Updated•1 year ago
|
Description
•