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

Unified Diff: Source/devtools/front_end/ui/SuggestBox.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/StatusBarButton.js ('k') | Source/devtools/front_end/ui/TabbedPane.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/devtools/front_end/ui/SuggestBox.js
diff --git a/Source/devtools/front_end/ui/SuggestBox.js b/Source/devtools/front_end/ui/SuggestBox.js
index 2f805dfc0805d4481dc34fdcc6f630ada9e0c50b..4672f13efd341b57c67332290a9bcfda91bb2d54 100644
--- a/Source/devtools/front_end/ui/SuggestBox.js
+++ b/Source/devtools/front_end/ui/SuggestBox.js
@@ -62,8 +62,7 @@ WebInspector.SuggestBox = function(suggestBoxDelegate, maxItemsHeight)
this._maxItemsHeight = maxItemsHeight;
this._bodyElement = document.body;
this._maybeHideBound = this._maybeHide.bind(this);
- this._element = document.createElement("div");
- this._element.className = "suggest-box";
+ this._element = document.createElementWithClass("div", "suggest-box");
this._element.addEventListener("mousedown", this._onBoxMouseDown.bind(this), true);
}
@@ -244,17 +243,13 @@ WebInspector.SuggestBox.prototype = {
*/
_createItemElement: function(prefix, text)
{
- var element = document.createElement("div");
- element.className = "suggest-box-content-item source-code";
+ var element = document.createElementWithClass("div", "suggest-box-content-item source-code");
element.tabIndex = -1;
if (prefix && prefix.length && !text.indexOf(prefix)) {
- var prefixElement = element.createChild("span", "prefix");
- prefixElement.textContent = prefix;
- var suffixElement = element.createChild("span", "suffix");
- suffixElement.textContent = text.substring(prefix.length);
+ element.createChild("span", "prefix").textContent = prefix;
+ element.createChild("span", "suffix").textContent = text.substring(prefix.length);
} else {
- var suffixElement = element.createChild("span", "suffix");
- suffixElement.textContent = text;
+ element.createChild("span", "suffix").textContent = text;
}
element.createChild("span", "spacer");
element.addEventListener("mousedown", this._onItemMouseDown.bind(this), false);
@@ -418,8 +413,7 @@ WebInspector.SuggestBox.prototype = {
*/
WebInspector.SuggestBox.Overlay = function()
{
- this.element = document.createElement("div");
- this.element.classList.add("suggest-box-overlay");
+ this.element = document.createElementWithClass("div", "suggest-box-overlay");
this._resize();
document.body.appendChild(this.element);
}
« no previous file with comments | « Source/devtools/front_end/ui/StatusBarButton.js ('k') | Source/devtools/front_end/ui/TabbedPane.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698