Bug 1271841 - Make DOM Node preview in console match syntax highlighting colors used in the markup view;r=jryans draft
authorBrian Grinstead <bgrinstead@mozilla.com>
Tue, 10 May 2016 17:30:02 -0700
changeset 365525 380eee8594f016d4484f7dde0d70352bc263af73
parent 365338 2f9351bae69d056e4615d21dda6bf42fec5d16b7
child 520590 3e43729f14177c20cd8e9e5e174cdb1f6023d54d
push id17779
push userbgrinstead@mozilla.com
push dateWed, 11 May 2016 00:30:11 +0000
reviewersjryans
bugs1271841
milestone49.0a1
Bug 1271841 - Make DOM Node preview in console match syntax highlighting colors used in the markup view;r=jryans MozReview-Commit-ID: FduYtfVMp8Q
devtools/client/webconsole/console-output.js
--- a/devtools/client/webconsole/console-output.js
+++ b/devtools/client/webconsole/console-output.js
@@ -3120,19 +3120,19 @@ Widgets.ObjectRenderers.add({
 
     let fragment = this.document.createDocumentFragment();
     if (addLink) {
       this._anchor(nodeName, { className: "cm-attribute", appendTo: fragment });
     } else {
       fragment.appendChild(this.el("span.cm-attribute", nodeName));
     }
 
-    this._text("=", fragment);
-    fragment.appendChild(this.el("span.console-string",
-                                 '"' + escapeHTML(value) + '"'));
+    this._text("=\"", fragment);
+    fragment.appendChild(this.el("span.theme-fg-color6", escapeHTML(value)));
+    this._text("\"", fragment);
 
     return fragment;
   },
 
   _renderTextNode: function()
   {
     let {preview} = this.objectActor;
     this.element = this.el("span.textNode.kind-" + preview.kind);
@@ -3198,18 +3198,18 @@ Widgets.ObjectRenderers.add({
 
   _renderElementNode: function()
   {
     let doc = this.document;
     let {attributes, nodeName} = this.objectActor.preview;
 
     this.element = this.el("span." + "kind-" + this.objectActor.preview.kind + ".elementNode");
 
+    this._text("<");
     let openTag = this.el("span.cm-tag");
-    openTag.textContent = "<";
     this.element.appendChild(openTag);
 
     let tagName = this._anchor(nodeName, {
       className: "cm-tag",
       appendTo: openTag
     });
 
     if (this.options.concise) {
@@ -3221,19 +3221,17 @@ Widgets.ObjectRenderers.add({
       }
     } else {
       for (let name of Object.keys(attributes)) {
         let attr = this._renderAttributeNode(" " + name, attributes[name]);
         this.element.appendChild(attr);
       }
     }
 
-    let closeTag = this.el("span.cm-tag");
-    closeTag.textContent = ">";
-    this.element.appendChild(closeTag);
+    this._text(">");
 
     // Register this widget in the owner message so that it gets destroyed when
     // the message is destroyed.
     this.message.widgets.add(this);
 
     this.linkToInspector().then(null, e => console.error(e));
   },