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

Unified Diff: Source/devtools/front_end/source_frame/SourceFrame.js

Issue 362273002: DevTools: Reduce code via using document.createElementWithClass and document.createChild. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 6 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: Source/devtools/front_end/source_frame/SourceFrame.js
diff --git a/Source/devtools/front_end/source_frame/SourceFrame.js b/Source/devtools/front_end/source_frame/SourceFrame.js
index 1fb01d8c55a3d49e724a8fd5b2d3564dbfdb7ae1..b48b14b106b21676ecc441210da380a00d4eb056 100644
--- a/Source/devtools/front_end/source_frame/SourceFrame.js
+++ b/Source/devtools/front_end/source_frame/SourceFrame.js
@@ -660,8 +660,7 @@ WebInspector.SourceFrame.prototype = {
this._textEditor.beginUpdates();
var messageBubbleElement = this._messageBubbles[lineNumber];
if (!messageBubbleElement) {
- messageBubbleElement = document.createElement("div");
- messageBubbleElement.className = "webkit-html-message-bubble";
+ messageBubbleElement = document.createElementWithClass("div", "webkit-html-message-bubble");
this._messageBubbles[lineNumber] = messageBubbleElement;
this._textEditor.addDecoration(lineNumber, messageBubbleElement);
}
@@ -678,13 +677,10 @@ WebInspector.SourceFrame.prototype = {
break;
}
- var messageLineElement = document.createElement("div");
- messageLineElement.className = "webkit-html-message-line";
- messageBubbleElement.appendChild(messageLineElement);
-
// Create the image element in the Inspector's document so we can use relative image URLs.
+ var messageLineElement = messageBubbleElement.createChild("div", "webkit-html-message-line");
messageLineElement.appendChild(imageElement);
- messageLineElement.appendChild(document.createTextNode(msg.messageText));
+ messageLineElement.createTextChild(msg.messageText);
rowMessage.element = messageLineElement;
rowMessage.repeatCount = 1;
« no previous file with comments | « Source/devtools/front_end/source_frame/ImageView.js ('k') | Source/devtools/front_end/sources/JavaScriptSourceFrame.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698