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

Unified Diff: Source/devtools/front_end/ui/StatusBarButton.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/SoftContextMenu.js ('k') | Source/devtools/front_end/ui/SuggestBox.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/devtools/front_end/ui/StatusBarButton.js
diff --git a/Source/devtools/front_end/ui/StatusBarButton.js b/Source/devtools/front_end/ui/StatusBarButton.js
index f88f0720b4848d2295ced820231cd65c940265d8..49d8eae6bbc6a17d577ecaefbeeb5b83941dc865 100644
--- a/Source/devtools/front_end/ui/StatusBarButton.js
+++ b/Source/devtools/front_end/ui/StatusBarButton.js
@@ -164,13 +164,8 @@ WebInspector.StatusBarButton = function(title, className, states)
this.element.className = className + " status-bar-item";
this.element.addEventListener("click", this._clicked.bind(this), false);
- this.glyph = document.createElement("div");
- this.glyph.className = "glyph";
- this.element.appendChild(this.glyph);
-
- this.glyphShadow = document.createElement("div");
- this.glyphShadow.className = "glyph shadow";
- this.element.appendChild(this.glyphShadow);
+ this.glyph = this.element.createChild("div", "glyph");
+ this.glyphShadow = this.element.createChild("div", "glyph shadow");
this.states = states;
if (!states)
@@ -238,9 +233,9 @@ WebInspector.StatusBarButton.prototype = {
if (this._state === x)
return;
- if (this.states === 2)
+ if (this.states === 2) {
this.element.classList.toggle("toggled-on", x);
- else {
+ } else {
this.element.classList.remove("toggled-" + this._state);
if (x !== 0)
this.element.classList.add("toggled-" + x);
@@ -330,13 +325,8 @@ WebInspector.StatusBarButton.prototype = {
if (!this._longClickOptionsData) {
this.makeLongClickEnabled();
- this.longClickGlyph = document.createElement("div");
- this.longClickGlyph.className = "fill long-click-glyph";
- this.element.appendChild(this.longClickGlyph);
-
- this.longClickGlyphShadow = document.createElement("div");
- this.longClickGlyphShadow.className = "fill long-click-glyph shadow";
- this.element.appendChild(this.longClickGlyphShadow);
+ this.longClickGlyph = this.element.createChild("div", "fill long-click-glyph");
+ this.longClickGlyphShadow = this.element.createChild("div", "fill long-click-glyph shadow");
var longClickDownListener = this._showOptions.bind(this);
this.addEventListener("longClickDown", longClickDownListener, this);
« no previous file with comments | « Source/devtools/front_end/ui/SoftContextMenu.js ('k') | Source/devtools/front_end/ui/SuggestBox.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698