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

Unified Diff: Source/devtools/front_end/elements/Spectrum.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
Index: Source/devtools/front_end/elements/Spectrum.js
diff --git a/Source/devtools/front_end/elements/Spectrum.js b/Source/devtools/front_end/elements/Spectrum.js
index 8d77ef2bf1a2213ebd397a6bbd06bb742d260748..fee8f56de428841fe540e2a032dcf4a58c6273b4 100644
--- a/Source/devtools/front_end/elements/Spectrum.js
+++ b/Source/devtools/front_end/elements/Spectrum.js
@@ -59,12 +59,9 @@ WebInspector.Spectrum = function()
this._alphaElement.addEventListener("input", alphaDrag.bind(this), false);
this._alphaElement.addEventListener("change", alphaDrag.bind(this), false);
- var swatchElement = document.createElement("span");
- swatchElement.className = "swatch";
- this._swatchInnerElement = swatchElement.createChild("span", "swatch-inner");
-
var displayContainer = this.element.createChild("div");
- displayContainer.appendChild(swatchElement);
+ var swatchElement = displayContainer.createChild("span", "swatch");
+ this._swatchInnerElement = swatchElement.createChild("span", "swatch-inner");
this._displayElement = displayContainer.createChild("span", "source-code spectrum-display-value");
WebInspector.Spectrum.draggable(this._sliderElement, hueDrag.bind(this));
@@ -433,11 +430,10 @@ WebInspector.SpectrumPopupHelper.prototype = {
*/
WebInspector.ColorSwatch = function(readOnly)
{
- this.element = document.createElement("span");
+ this.element = document.createElementWithClass("span", "swatch");
this._swatchInnerElement = this.element.createChild("span", "swatch-inner");
var shiftClickMessage = WebInspector.UIString("Shift-click to change color format.");
this.element.title = readOnly ? shiftClickMessage : String.sprintf("%s\n%s", WebInspector.UIString("Click to open a colorpicker."), shiftClickMessage);
- this.element.className = "swatch";
this.element.addEventListener("mousedown", consumeEvent, false);
this.element.addEventListener("dblclick", consumeEvent, false);
}
« no previous file with comments | « Source/devtools/front_end/console/ConsoleView.js ('k') | Source/devtools/front_end/source_frame/GoToLineDialog.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698