Open
Bug 1463064
Opened 7 years ago
Updated 3 years ago
Misleading error message "Constructor HTMLElement requires 'new'"
Categories
(Core :: DOM: Core & HTML, defect, P3)
Tracking
()
UNCONFIRMED
People
(Reporter: mdn, Unassigned)
Details
(Keywords: dev-doc-needed)
User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.13; rv:60.0) Gecko/20100101 Firefox/60.0
Build ID: 20180503143129
Steps to reproduce:
Run this JavaScript:
HTMLElement()
Actual results:
A TypeError is thrown with the message "Constructor HTMLElement requires 'new'".
Expected results:
new HTMLElement() throws a TypeError as well.
The error message should rather say "Constructor HTMLElement cannot be invoked", or something alike.
Updated•7 years ago
|
Has STR: --- → yes
Component: Untriaged → Developer Tools: Console
OS: Unspecified → All
Hardware: Unspecified → All
Comment 1•7 years ago
|
||
Hello, thanks for reporting mdn !
The console is only the consumer of the message here, I suspect this bug should be in the JS engine module so the right person can pick this up.
That being said, I'm seeing 2 different error messages if I omit or not the `new` keyword, and they both provide accurate information:
-> HTMLElement()
<- TypeError: Constructor HTMLElement requires 'new'
-> new HTMLElement()
<- TypeError: Illegal constructor.
Component: Developer Tools: Console → DOM
Product: Firefox → Core
Updated•7 years ago
|
Priority: -- → P3
Updated•7 years ago
|
Keywords: dev-doc-needed
Assignee | ||
Updated•6 years ago
|
Component: DOM → DOM: Core & HTML
Updated•3 years ago
|
Severity: normal → S3
You need to log in
before you can comment on or make changes to this bug.
Description
•