@@ -13,6 +13,8 @@ const { Trace, TraceError } = require("firebug.sdk/lib/core/trace.js").get(modul
13
13
const { devtools } = Cu . import ( "resource://gre/modules/devtools/Loader.jsm" , { } ) ;
14
14
const { Widgets } = devtools . require ( "devtools/webconsole/console-output" ) ;
15
15
16
+ const XHTML_NS = "http://www.w3.org/1999/xhtml" ;
17
+
16
18
/**
17
19
* @widget This object represents a widget that is used to render
18
20
* generic jQuery object preview.
@@ -53,19 +55,21 @@ var JQueryRenderer = {
53
55
isFirst = false ;
54
56
55
57
if ( emptySlots ) {
56
- this . _renderEmptySlots ( emptySlots ) ;
58
+ this . renderEmptySlots ( emptySlots ) ;
57
59
emptySlots = 0 ;
58
60
}
59
61
60
62
let shortVal = this . message . shortenValueGrip ( item ) ;
61
63
let elem = this . message . _renderValueGrip ( shortVal , { concise : true } ) ;
62
64
this . element . appendChild ( elem ) ;
65
+
66
+ this . renderCache ( item , elem ) ;
63
67
}
64
68
}
65
69
66
70
if ( emptySlots ) {
67
71
renderSeparator ( ) ;
68
- this . _renderEmptySlots ( emptySlots , false ) ;
72
+ this . renderEmptySlots ( emptySlots , false ) ;
69
73
}
70
74
71
75
let shown = items . length ;
@@ -80,14 +84,25 @@ var JQueryRenderer = {
80
84
this . _text ( " )" ) ;
81
85
} ,
82
86
83
- _renderEmptySlots : function ( aNumSlots , aAppendComma = true ) {
87
+ renderEmptySlots : function ( aNumSlots , aAppendComma = true ) {
84
88
let slotLabel = l10n . getStr ( "emptySlotLabel" ) ;
85
89
let slotText = PluralForm . get ( aNumSlots , slotLabel ) ;
86
90
this . _text ( "<" + slotText . replace ( "#1" , aNumSlots ) + ">" ) ;
87
91
if ( aAppendComma ) {
88
92
this . _text ( ", " ) ;
89
93
}
90
94
} ,
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 = "✉"
104
+ parentNode . appendChild ( cache ) ;
105
+ }
91
106
} ;
92
107
93
108
Widgets . ObjectRenderers . add ( JQueryRenderer ) ;
0 commit comments