Open
Bug 901841
Opened 11 years ago
Updated 2 years ago
Error message for invalid regular expressions in 'pattern' attribute lacks information about where it occurred
Categories
(Core :: DOM: Core & HTML, enhancement, P3)
Core
DOM: Core & HTML
Tracking
()
NEW
People
(Reporter: sebo, Unassigned)
References
(Blocks 1 open bug)
Details
Attachments
(1 file)
(deleted),
text/html
|
Details |
When an <input> has an invalid regular expression set inside its 'pattern' attribute, the following error message will be logged to the console:
SyntaxError: invalid quantifier
This message lacks any source information, so you won't know where this error comes from and why it happened.
It should refer to the element the pattern is defined for.
For reference, this was first reported to Firebug.[1]
Test case:
1. Open the attached patternError.html
2. Open the browser console via Ctrl+Shift+J
=> The console will list a "SyntaxError: invalid quantifier" message.
Also this message seems to be logged twice while there is just one error. Reloading the page even logs it three times.
Sebastian
[1] http://code.google.com/p/fbug/issues/detail?id=6646
Comment 1•11 years ago
|
||
> It should refer to the element the pattern is defined for.
How would you like it to do that?
Reporter | ||
Comment 2•11 years ago
|
||
IMO the best way would be to create a new interface inheriting from nsIConsoleMessage[1] similar to nsIScriptError[2], which has an attribute holding the reference to the element (similar to the 'target' property of events) instead of 'sourceLine' and 'columnNumber'.
Sebastian
[1] http://mxr.mozilla.org/mozilla-central/source/xpcom/base/nsIConsoleMessage.idl
[2] http://mxr.mozilla.org/mozilla-central/source/js/xpconnect/idl/nsIScriptError.idl
Comment 3•11 years ago
|
||
https://bugzilla.mozilla.org/show_bug.cgi?id=906179
use this as a second test case. I don't know whether it's a js thing or a pattern attrib thing.
Comment 4•11 years ago
|
||
No message:
http://hg.mozilla.org/mozilla-central/rev/3c0d0a2a7a60
Mozilla/5.0 (Windows NT 6.1; WOW64; rv:2.0b5pre) Gecko/20100821 Minefield/4.0b5pre ID:20100821133553
invalid quantifier:
http://hg.mozilla.org/mozilla-central/rev/455320ccc851
Mozilla/5.0 (Windows NT 6.1; WOW64; rv:2.0b5pre) Gecko/20100821 Minefield/4.0b5pre ID:20100821175917
Pushlog:
http://hg.mozilla.org/mozilla-central/pushloghtml?fromchange=3c0d0a2a7a60&tochange=455320ccc851
Blocks: PortYarr
Updated•11 years ago
|
Status: UNCONFIRMED → NEW
Ever confirmed: true
Reporter | ||
Updated•10 years ago
|
Attachment #786154 -
Attachment mime type: text/plain → text/html
Reporter | ||
Comment 5•7 years ago
|
||
The message improved a lot since a last checked. It now says "Unable to check <input pattern='^.**$'> because the pattern is not a valid regexp: nothing to repeat".
Only the reference to the actual element where the error occurred is still missing.
Sebastian
Blocks: jserror
Updated•6 years ago
|
Priority: -- → P3
Assignee | ||
Updated•6 years ago
|
Component: DOM → DOM: Core & HTML
Updated•2 years ago
|
Severity: normal → S3
You need to log in
before you can comment on or make changes to this bug.
Description
•