Skip to content

Commit ebe08d9

Browse files
committed
Render jQuery cache indicator
1 parent 3f3b366 commit ebe08d9

File tree

3 files changed

+26
-5
lines changed

3 files changed

+26
-5
lines changed

chrome/skin/classic/shared/firequery.css

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,9 @@
33
.kind-jQueryObject .cm-variable {
44
color: #4B0082;
55
}
6+
7+
.kind-jQueryObject .jQueryCache {
8+
font-size: 11px;
9+
color: #4B0082;
10+
margin-left: 2px;
11+
}

lib/firequery-actor.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ var FireQueryActor = ActorClass(
154154
let grip = actor.threadActor.createValueGrip(value);
155155
items.push(grip);
156156

157-
let cache = evalJQueryCache(desc.value);
157+
let cache = hasJQueryCache(desc.value);
158158
if (cache) {
159159
grip.preview.cache = cache;
160160
}
@@ -221,7 +221,7 @@ function hasJQueryCache(object) {
221221
var cache = evalJQueryCache(object);
222222
for (var x in cache) {
223223
if (cache.hasOwnProperty(x)) {
224-
return true;
224+
return cache;
225225
}
226226
}
227227
};

lib/jquery-renderer.js

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ const { Trace, TraceError } = require("firebug.sdk/lib/core/trace.js").get(modul
1313
const { devtools } = Cu.import("resource://gre/modules/devtools/Loader.jsm", {});
1414
const { Widgets } = devtools.require("devtools/webconsole/console-output");
1515

16+
const XHTML_NS = "http://www.w3.org/1999/xhtml";
17+
1618
/**
1719
* @widget This object represents a widget that is used to render
1820
* generic jQuery object preview.
@@ -53,19 +55,21 @@ var JQueryRenderer = {
5355
isFirst = false;
5456

5557
if (emptySlots) {
56-
this._renderEmptySlots(emptySlots);
58+
this.renderEmptySlots(emptySlots);
5759
emptySlots = 0;
5860
}
5961

6062
let shortVal = this.message.shortenValueGrip(item);
6163
let elem = this.message._renderValueGrip(shortVal, { concise: true });
6264
this.element.appendChild(elem);
65+
66+
this.renderCache(item, elem);
6367
}
6468
}
6569

6670
if (emptySlots) {
6771
renderSeparator();
68-
this._renderEmptySlots(emptySlots, false);
72+
this.renderEmptySlots(emptySlots, false);
6973
}
7074

7175
let shown = items.length;
@@ -80,14 +84,25 @@ var JQueryRenderer = {
8084
this._text(" )");
8185
},
8286

83-
_renderEmptySlots: function(aNumSlots, aAppendComma=true) {
87+
renderEmptySlots: function(aNumSlots, aAppendComma=true) {
8488
let slotLabel = l10n.getStr("emptySlotLabel");
8589
let slotText = PluralForm.get(aNumSlots, slotLabel);
8690
this._text("<" + slotText.replace("#1", aNumSlots) + ">");
8791
if (aAppendComma) {
8892
this._text(", ");
8993
}
9094
},
95+
96+
renderCache: function(element, parentNode) {
97+
if (!element.preview.cache) {
98+
return;
99+
}
100+
101+
let cache = this.document.createElementNS(XHTML_NS, "span");
102+
cache.className = "jQueryCache"
103+
cache.innerHTML = "&#9993;"
104+
parentNode.appendChild(cache);
105+
}
91106
};
92107

93108
Widgets.ObjectRenderers.add(JQueryRenderer);

0 commit comments

Comments
 (0)