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

Side by Side Diff: Source/devtools/front_end/ui/SidebarTreeElement.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, 5 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2008 Apple Inc. All Rights Reserved. 2 * Copyright (C) 2008 Apple Inc. All Rights Reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 * @param {string} className 76 * @param {string} className
77 * @param {string} title 77 * @param {string} title
78 * @param {string=} subtitle 78 * @param {string=} subtitle
79 * @param {?Object=} representedObject 79 * @param {?Object=} representedObject
80 * @param {boolean=} hasChildren 80 * @param {boolean=} hasChildren
81 */ 81 */
82 WebInspector.SidebarTreeElement = function(className, title, subtitle, represent edObject, hasChildren) 82 WebInspector.SidebarTreeElement = function(className, title, subtitle, represent edObject, hasChildren)
83 { 83 {
84 TreeElement.call(this, "", representedObject, hasChildren); 84 TreeElement.call(this, "", representedObject, hasChildren);
85 85
86 if (hasChildren) { 86 if (hasChildren)
87 this.disclosureButton = document.createElement("button"); 87 this.disclosureButton = document.createElementWithClass("button", "discl osure-button");
88 this.disclosureButton.className = "disclosure-button";
89 }
90 88
91 this.iconElement = document.createElementWithClass("div", "icon"); 89 this.iconElement = document.createElementWithClass("div", "icon");
92 this.statusElement = document.createElementWithClass("div", "status"); 90 this.statusElement = document.createElementWithClass("div", "status");
93 this.titlesElement = document.createElementWithClass("div", "titles"); 91 this.titlesElement = document.createElementWithClass("div", "titles");
94 92
95 this.titleContainer = this.titlesElement.createChild("span", "title-containe r"); 93 this.titleContainer = this.titlesElement.createChild("span", "title-containe r");
96 this.titleElement = this.titleContainer.createChild("span", "title"); 94 this.titleElement = this.titleContainer.createChild("span", "title");
97 95
98 this.subtitleElement = this.titlesElement.createChild("span", "subtitle"); 96 this.subtitleElement = this.titlesElement.createChild("span", "subtitle");
99 97
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
173 171
174 if (this.className) 172 if (this.className)
175 this.listItemElement.classList.add(this.className); 173 this.listItemElement.classList.add(this.className);
176 174
177 if (this.small) 175 if (this.small)
178 this.listItemElement.classList.add("small"); 176 this.listItemElement.classList.add("small");
179 177
180 if (this.hasChildren && this.disclosureButton) 178 if (this.hasChildren && this.disclosureButton)
181 this.listItemElement.appendChild(this.disclosureButton); 179 this.listItemElement.appendChild(this.disclosureButton);
182 180
183 this.listItemElement.appendChild(this.iconElement); 181 this.listItemElement.appendChildren(this.iconElement, this.statusElement , this.titlesElement);
184 this.listItemElement.appendChild(this.statusElement);
185 this.listItemElement.appendChild(this.titlesElement);
186 }, 182 },
187 183
188 onreveal: function() 184 onreveal: function()
189 { 185 {
190 if (this.listItemElement) 186 if (this.listItemElement)
191 this.listItemElement.scrollIntoViewIfNeeded(false); 187 this.listItemElement.scrollIntoViewIfNeeded(false);
192 }, 188 },
193 189
194 __proto__: TreeElement.prototype 190 __proto__: TreeElement.prototype
195 } 191 }
OLDNEW
« no previous file with comments | « Source/devtools/front_end/ui/SettingsUI.js ('k') | Source/devtools/front_end/ui/SoftContextMenu.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698