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

Side by Side Diff: Source/devtools/front_end/DOMPresentationUtils.js

Issue 83123002: DevTools: Move DOMNode.appropriateSelectorFor() into DOMPresentationUtil. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 1 month 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
« no previous file with comments | « Source/devtools/front_end/DOMAgent.js ('k') | Source/devtools/front_end/ElementsPanel.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2011 Google Inc. All rights reserved. 2 * Copyright (C) 2011 Google Inc. All rights reserved.
3 * Copyright (C) 2007, 2008 Apple Inc. All rights reserved. 3 * Copyright (C) 2007, 2008 Apple Inc. All rights reserved.
4 * Copyright (C) 2008 Matt Lilek <webkit@mattlilek.com> 4 * Copyright (C) 2008 Matt Lilek <webkit@mattlilek.com>
5 * Copyright (C) 2009 Joseph Pecoraro 5 * Copyright (C) 2009 Joseph Pecoraro
6 * 6 *
7 * Redistribution and use in source and binary forms, with or without 7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions 8 * modification, are permitted provided that the following conditions
9 * are met: 9 * are met:
10 * 10 *
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 else 151 else
152 description = WebInspector.UIString("%d \xd7 %d pixels (Natural: %d \xd7 %d pixels)", offsetWidth, offsetHeight, naturalWidth, naturalHeight); 152 description = WebInspector.UIString("%d \xd7 %d pixels (Natural: %d \xd7 %d pixels)", offsetWidth, offsetHeight, naturalWidth, naturalHeight);
153 } 153 }
154 154
155 container.createChild("tr").createChild("td", "image-container").appendC hild(imageElement); 155 container.createChild("tr").createChild("td", "image-container").appendC hild(imageElement);
156 if (description) 156 if (description)
157 container.createChild("tr").createChild("td").createChild("span", "d escription").textContent = description; 157 container.createChild("tr").createChild("td").createChild("span", "d escription").textContent = description;
158 userCallback(container); 158 userCallback(container);
159 } 159 }
160 } 160 }
161
162 /**
163 * @param {!WebInspector.DOMNode} node
164 * @param {boolean=} justSelector
165 * @return {string}
166 */
167 WebInspector.DOMPresentationUtils.appropriateSelectorFor = function(node, justSe lector)
168 {
169 var lowerCaseName = node.localName() || node.nodeName().toLowerCase();
170
171 var id = node.getAttribute("id");
172 if (id) {
173 var selector = "#" + id;
174 return (justSelector ? selector : lowerCaseName + selector);
175 }
176
177 var className = node.getAttribute("class");
178 if (className) {
179 var selector = "." + className.trim().replace(/\s+/g, ".");
180 return (justSelector ? selector : lowerCaseName + selector);
181 }
182
183 if (lowerCaseName === "input" && node.getAttribute("type"))
184 return lowerCaseName + "[type=\"" + node.getAttribute("type") + "\"]";
185
186 return lowerCaseName;
187 }
OLDNEW
« no previous file with comments | « Source/devtools/front_end/DOMAgent.js ('k') | Source/devtools/front_end/ElementsPanel.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698