Use single quotes to wrap strings in reps to require less escaping for JSON / HTML strings
Categories
(DevTools :: Console, enhancement, P3)
Tracking
(firefox57 wontfix, firefox110 fixed)
People
(Reporter: Oriol, Assigned: Oriol)
References
Details
Attachments
(2 files)
Updated•8 years ago
|
| Assignee | ||
Comment 2•8 years ago
|
||
Comment 3•8 years ago
|
||
Comment 4•8 years ago
|
||
| Assignee | ||
Comment 5•8 years ago
|
||
Comment 6•8 years ago
|
||
Updated•8 years ago
|
Updated•7 years ago
|
Comment 7•4 years ago
|
||
Hello!
Any news on this issue? I asked about it on Stack Overflow but it brought me back here ^^
It really looks like simply replacing the double quotes by single quotes would make logged JSON and HTML strings more readable while still fulfilling @tromey's three technical requirements. After all, Node is already doing that.
Correct me if I am wrong but I think there's only a few lines two tweak here to make it work.
Anybody working on it? I'd be happy to do it myself although I'll have to learn how to contribute to the Mozilla code base :)
| Assignee | ||
Comment 8•4 years ago
|
||
It's reassuring to know that I'm not the only one annoyed by the current behavior :)
Nobody was working on it, so I'm assigning it to you.
You can read https://firefox-source-docs.mozilla.org/setup/index.html to know how to build and contribute to Firefox.
Comment 9•4 years ago
|
||
Ok perfect! I'll do that before next year (lol)
Comment 10•4 years ago
|
||
Comment 11•3 years ago
|
||
The bug assignee didn't login in Bugzilla in the last 7 months.
:nchevobbe, could you have a look please?
For more information, please visit auto_nag documentation.
Updated•3 years ago
|
| Assignee | ||
Comment 12•3 years ago
|
||
It's worth noting that Chromium does this now:
- If the string doesn't contain
', uses'as the delimiter. - Else, if the string doesn't contain
", uses"as the delimiter. - Else, if the string doesn't contain
`nor${, uses`as the delimiter. - Else, uses
'as the delimiter, escaping'characters.
That's better than Firefox.
Also see https://bugs.chromium.org/p/chromium/issues/detail?id=1208389
We had previously changed the display of strings in the DevTools Console to properly escape special characters in a way that the displayed string is always a valid JavaScript (and JSON) string and can be copied verbatim into source code. That approach uses JSON.stringify() to accomplish this. However for the human eye that can be difficult to consume, and we should try to be a bit smarter about the concrete way in which we display strings (using ", ', or ` as appropriate to minimize the escaping like the Node.js REPL does).
Updated•3 years ago
|
| Assignee | ||
Comment 14•2 years ago
|
||
This will benefit strings coming from outerHTML or JSON.stringify(), which tend
to contain lots of double quotes that had to be escaped.
That's the same approach as Chromium, except that it prioritizes double quotes
over single ones to reduce the change.
Updated•2 years ago
|
Comment 15•2 years ago
|
||
Comment 16•2 years ago
|
||
| bugherder | ||
Description
•