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

Side by Side Diff: Source/devtools/front_end/components/DOMBreakpointsSidebarPane.js

Issue 662793002: [DevTools] Replace usages of document with custom functions. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 2 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) 2011 Google Inc. All rights reserved. 2 * Copyright (C) 2011 Google 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 are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 substitutions.push(targetNodeLink); 153 substitutions.push(targetNodeLink);
154 } else 154 } else
155 message = "Paused on a \"%s\" breakpoint set on %s, because a new child was added to that node."; 155 message = "Paused on a \"%s\" breakpoint set on %s, because a new child was added to that node.";
156 } else { 156 } else {
157 message = "Paused on a \"%s\" breakpoint set on %s, because its descendant %s was removed."; 157 message = "Paused on a \"%s\" breakpoint set on %s, because its descendant %s was removed.";
158 substitutions.push(targetNodeLink); 158 substitutions.push(targetNodeLink);
159 } 159 }
160 } else 160 } else
161 message = "Paused on a \"%s\" breakpoint set on %s."; 161 message = "Paused on a \"%s\" breakpoint set on %s.";
162 162
163 var element = document.createElement("span"); 163 var element = createElement("span");
164 var formatters = { 164 var formatters = {
165 s: function(substitution) 165 s: function(substitution)
166 { 166 {
167 return substitution; 167 return substitution;
168 } 168 }
169 }; 169 };
170 function append(a, b) 170 function append(a, b)
171 { 171 {
172 if (typeof b === "string") 172 if (typeof b === "string")
173 b = document.createTextNode(b); 173 b = createTextNode(b);
174 element.appendChild(b); 174 element.appendChild(b);
175 } 175 }
176 WebInspector.formatLocalized(message, substitutions, formatters, "", app end); 176 WebInspector.formatLocalized(message, substitutions, formatters, "", app end);
177 177
178 callback(element); 178 callback(element);
179 }, 179 },
180 180
181 _nodeRemoved: function(event) 181 _nodeRemoved: function(event)
182 { 182 {
183 var node = event.data.node; 183 var node = event.data.node;
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
221 DOMDebuggerAgent.setDOMBreakpoint(node.id, type); 221 DOMDebuggerAgent.setDOMBreakpoint(node.id, type);
222 }, 222 },
223 223
224 /** 224 /**
225 * @param {!WebInspector.DOMNode} node 225 * @param {!WebInspector.DOMNode} node
226 * @param {string} type 226 * @param {string} type
227 * @param {boolean} enabled 227 * @param {boolean} enabled
228 */ 228 */
229 _createBreakpointElement: function(node, type, enabled) 229 _createBreakpointElement: function(node, type, enabled)
230 { 230 {
231 var element = document.createElement("li"); 231 var element = createElement("li");
232 element._node = node; 232 element._node = node;
233 element._type = type; 233 element._type = type;
234 element.addEventListener("contextmenu", this._contextMenu.bind(this, nod e, type), true); 234 element.addEventListener("contextmenu", this._contextMenu.bind(this, nod e, type), true);
235 235
236 var checkboxElement = document.createElement("input"); 236 var checkboxElement = createElement("input");
237 checkboxElement.className = "checkbox-elem"; 237 checkboxElement.className = "checkbox-elem";
238 checkboxElement.type = "checkbox"; 238 checkboxElement.type = "checkbox";
239 checkboxElement.checked = enabled; 239 checkboxElement.checked = enabled;
240 checkboxElement.addEventListener("click", this._checkboxClicked.bind(thi s, node, type), false); 240 checkboxElement.addEventListener("click", this._checkboxClicked.bind(thi s, node, type), false);
241 element._checkboxElement = checkboxElement; 241 element._checkboxElement = checkboxElement;
242 element.appendChild(checkboxElement); 242 element.appendChild(checkboxElement);
243 243
244 var labelElement = document.createElement("span"); 244 var labelElement = createElement("span");
245 element.appendChild(labelElement); 245 element.appendChild(labelElement);
246 246
247 var linkifiedNode = WebInspector.DOMPresentationUtils.linkifyNodeReferen ce(node); 247 var linkifiedNode = WebInspector.DOMPresentationUtils.linkifyNodeReferen ce(node);
248 linkifiedNode.classList.add("monospace"); 248 linkifiedNode.classList.add("monospace");
249 labelElement.appendChild(linkifiedNode); 249 labelElement.appendChild(linkifiedNode);
250 250
251 var description = document.createElement("div"); 251 var description = createElement("div");
252 description.className = "source-text"; 252 description.className = "source-text";
253 description.textContent = this._breakpointTypeLabels[type]; 253 description.textContent = this._breakpointTypeLabels[type];
254 labelElement.appendChild(description); 254 labelElement.appendChild(description);
255 255
256 var currentElement = this.listElement.firstChild; 256 var currentElement = this.listElement.firstChild;
257 while (currentElement) { 257 while (currentElement) {
258 if (currentElement._type && currentElement._type < element._type) 258 if (currentElement._type && currentElement._type < element._type)
259 break; 259 break;
260 currentElement = currentElement.nextSibling; 260 currentElement = currentElement.nextSibling;
261 } 261 }
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after
474 this.element.appendChild(this.bodyElement); 474 this.element.appendChild(this.bodyElement);
475 }, 475 },
476 476
477 __proto__: WebInspector.SidebarPane.prototype 477 __proto__: WebInspector.SidebarPane.prototype
478 } 478 }
479 479
480 /** 480 /**
481 * @type {!WebInspector.DOMBreakpointsSidebarPane} 481 * @type {!WebInspector.DOMBreakpointsSidebarPane}
482 */ 482 */
483 WebInspector.domBreakpointsSidebarPane; 483 WebInspector.domBreakpointsSidebarPane;
OLDNEW
« no previous file with comments | « Source/devtools/front_end/audits/AuditsPanel.js ('k') | Source/devtools/front_end/components/DOMPresentationUtils.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698