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

Unified Diff: Source/devtools/front_end/ui/TextPrompt.js

Issue 367093003: DevTools: More code reduce 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
« no previous file with comments | « Source/devtools/front_end/ui/TabbedPane.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/devtools/front_end/ui/TextPrompt.js
diff --git a/Source/devtools/front_end/ui/TextPrompt.js b/Source/devtools/front_end/ui/TextPrompt.js
index 8efa6190b3d4eb37ccb5cdc635ff6ac2e3097fa6..909135022016ab3b25485686c0f8caa72dbb4c29 100644
--- a/Source/devtools/front_end/ui/TextPrompt.js
+++ b/Source/devtools/front_end/ui/TextPrompt.js
@@ -157,9 +157,10 @@ WebInspector.TextPrompt.prototype = {
if (!x) {
// Append a break element instead of setting textContent to make sure the selection is inside the prompt.
this._element.removeChildren();
- this._element.appendChild(document.createElement("br"));
- } else
+ this._element.createChild("br");
+ } else {
this._element.textContent = x;
+ }
this.moveCaretToEndOfPrompt();
this._element.scrollIntoView();
@@ -481,8 +482,7 @@ WebInspector.TextPrompt.prototype = {
var prefixTextNode = document.createTextNode(prefixText);
fullWordRange.insertNode(prefixTextNode);
- this.autoCompleteElement = document.createElement("span");
- this.autoCompleteElement.className = "auto-complete-text";
+ this.autoCompleteElement = document.createElementWithClass("span", "auto-complete-text");
this.autoCompleteElement.textContent = suffixText;
prefixTextNode.parentNode.insertBefore(this.autoCompleteElement, prefixTextNode.nextSibling);
« no previous file with comments | « Source/devtools/front_end/ui/TabbedPane.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698