Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(773)

Unified Diff: third_party/WebKit/Source/devtools/front_end/elements/ElementsTreeElement.js

Issue 2300633005: DevTools: Remove leading newline on scripts immediately (Closed)
Patch Set: fix test Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/devtools/front_end/elements/ElementsTreeElement.js
diff --git a/third_party/WebKit/Source/devtools/front_end/elements/ElementsTreeElement.js b/third_party/WebKit/Source/devtools/front_end/elements/ElementsTreeElement.js
index f9545ac8bf38f7d7330b5e786f7258b431f8bc0f..d722dde46065877c64aaa632d4fb50b1a1a9ea89 100644
--- a/third_party/WebKit/Source/devtools/front_end/elements/ElementsTreeElement.js
+++ b/third_party/WebKit/Source/devtools/front_end/elements/ElementsTreeElement.js
@@ -1445,13 +1445,15 @@ WebInspector.ElementsTreeElement.prototype = {
case Node.TEXT_NODE:
if (node.parentNode && node.parentNode.nodeName().toLowerCase() === "script") {
var newNode = titleDOM.createChild("span", "webkit-html-text-node webkit-html-js-node");
- newNode.textContent = node.nodeValue();
+ var text = node.nodeValue();
+ newNode.textContent = text.startsWith("\n") ? text.substring(1) : text;
var javascriptSyntaxHighlighter = new WebInspector.DOMSyntaxHighlighter("text/javascript", true);
javascriptSyntaxHighlighter.syntaxHighlightNode(newNode).then(updateSearchHighlight.bind(this));
} else if (node.parentNode && node.parentNode.nodeName().toLowerCase() === "style") {
var newNode = titleDOM.createChild("span", "webkit-html-text-node webkit-html-css-node");
- newNode.textContent = node.nodeValue();
+ var text = node.nodeValue();
+ newNode.textContent = text.startsWith("\n") ? text.substring(1) : text;
var cssSyntaxHighlighter = new WebInspector.DOMSyntaxHighlighter("text/css", true);
cssSyntaxHighlighter.syntaxHighlightNode(newNode).then(updateSearchHighlight.bind(this));

Powered by Google App Engine
This is Rietveld 408576698