Title: [185716] trunk/Source/WebInspectorUI
- Revision
- 185716
- Author
- [email protected]
- Date
- 2015-06-18 12:21:22 -0700 (Thu, 18 Jun 2015)
Log Message
Web Inspector: Improve a few more node preview types
https://bugs.webkit.org/show_bug.cgi?id=146048
Reviewed by Timothy Hatcher.
* UserInterface/Views/FormattedValue.js:
(WebInspector.FormattedValue.createElementForNodePreview):
Modified Paths
Diff
Modified: trunk/Source/WebInspectorUI/ChangeLog (185715 => 185716)
--- trunk/Source/WebInspectorUI/ChangeLog 2015-06-18 19:16:40 UTC (rev 185715)
+++ trunk/Source/WebInspectorUI/ChangeLog 2015-06-18 19:21:22 UTC (rev 185716)
@@ -1,3 +1,13 @@
+2015-06-18 Joseph Pecoraro <[email protected]>
+
+ Web Inspector: Improve a few more node preview types
+ https://bugs.webkit.org/show_bug.cgi?id=146048
+
+ Reviewed by Timothy Hatcher.
+
+ * UserInterface/Views/FormattedValue.js:
+ (WebInspector.FormattedValue.createElementForNodePreview):
+
2015-06-18 Devin Rousso <[email protected]>
Web Inspector: New Rule button doesn't reveal the newly added rule if not visible upon creation
Modified: trunk/Source/WebInspectorUI/UserInterface/Views/FormattedValue.js (185715 => 185716)
--- trunk/Source/WebInspectorUI/UserInterface/Views/FormattedValue.js 2015-06-18 19:16:40 UTC (rev 185715)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/FormattedValue.js 2015-06-18 19:21:22 UTC (rev 185716)
@@ -69,15 +69,34 @@
WebInspector.FormattedValue.createElementForNodePreview = function(preview)
{
+ var value = preview.value;
var span = document.createElement("span");
span.className = "formatted-node-preview syntax-highlighted";
- // A node preview has a very strict format, with at most a single attribute.
+ // Comment node preview.
+ if (value.startsWith("<!--")) {
+ var comment = span.appendChild(document.createElement("span"));
+ comment.className = "html-comment";
+ comment.textContent = value;
+ return span;
+ }
+
+ // Doctype node preview.
+ if (value.startsWith("<!DOCTYPE")) {
+ var doctype = span.appendChild(document.createElement("span"));
+ doctype.className = "html-doctype";
+ doctype.textContent = value;
+ return span;
+ }
+
+ // Element node previews have a very strict format, with at most a single attribute.
// We can style it up like a DOMNode without interactivity.
- var matches = preview.value.match(/^<(\S+?)(?: (\S+?)="(.*?)")?>$/);
+ var matches = value.match(/^<(\S+?)(?: (\S+?)="(.*?)")?>$/);
+
+ // Remaining node types are often #text, #document, etc, with attribute nodes potentially being any string.
if (!matches) {
- console.error("Node preview did not match format.", preview.value)
- span.textContent = preview.value;
+ console.assert(!value.startsWith("<"), "Unexpected node preview format: " + value);
+ span.textContent = value;
return span;
}
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes