Closed
Bug 1622032
Opened 4 years ago
Closed 4 years ago
Element.replaceChild should give helpful error if you use the (old, new) argument order by detecting if `old` has no parent and `new` *is* in the correct parent
Categories
(Core :: DOM: Core & HTML, defect, P3)
Core
DOM: Core & HTML
Tracking
()
RESOLVED
FIXED
mozilla76
Tracking | Status | |
---|---|---|
firefox76 | --- | fixed |
People
(Reporter: Gijs, Assigned: bzbarsky)
Details
Attachments
(2 files)
This keeps tripping everyone up, because really replaceChild(old, new)
would make more sense. It would be nice to have a "nice" warning that tells developers they're messing up the order. Right now we just say "Node not found" (because the "old" node is the new node, and it isn't a child of the parent on which replaceChild
is called), which is... unhelpful.
Priority: -- → P3
Assignee | ||
Comment 2•4 years ago
|
||
"Old" is our current exception message. "New" is the new one with the patch that's coming up. "Chrome" is Chrome's message.
Assignee | ||
Updated•4 years ago
|
Attachment #9132984 -
Attachment mime type: text/plain → text/html
Assignee | ||
Updated•4 years ago
|
Attachment #9132984 -
Attachment filename: file_1622032.txt → file_1622032.html
Assignee | ||
Comment 3•4 years ago
|
||
In particular, improve the error message for replaceChild when the two arguments get switched.
Updated•4 years ago
|
Assignee: nobody → bzbarsky
Status: NEW → ASSIGNED
Pushed by bzbarsky@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/34c321955d42 Improve some error messages in nsINode. r=nika
Comment 5•4 years ago
|
||
bugherder |
Status: ASSIGNED → RESOLVED
Closed: 4 years ago
status-firefox76:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla76
You need to log in
before you can comment on or make changes to this bug.
Description
•