@@ -33,11 +33,17 @@ const ToolboxOverlayId = FireQueryToolboxOverlay.prototype.overlayId;
33
33
34
34
/**
35
35
* @overlay This object represents an overlay for the existing
36
- * Inspector panel which is responsible for customization.
36
+ * Inspector panel. The overlay is responsible for customization
37
+ * of the panel.
37
38
*
38
39
* Every element that has jQuery.data associated has additional
39
40
* icon rendered right next to it. Clicking on the icon opens
40
41
* a tooltip displaying the data.
42
+ *
43
+ * It's also possible to right click on the icon and pick
44
+ * 'Show DOM Properties' - it'll show jQuery.data in the
45
+ * Variables View (Console's panel side panel). This built-in
46
+ * action is usually used for elements.
41
47
*/
42
48
const InspectorOverlay = Class (
43
49
/** @lends InspectorOverlay */
@@ -144,7 +150,7 @@ const InspectorOverlay = Class(
144
150
//Trace.sysout("InspectorOverlay.onMarkupViewContainerCreated;");
145
151
146
152
// Create a little data-icon indicating that the rendered element
147
- // has jQuery.data associated. Clickin on the icon opens a tooltip
153
+ // has jQuery.data associated. Clicking on the icon opens a tooltip
148
154
// with more details.
149
155
let nodeFront = container . node ;
150
156
if ( this . hasJQueryData ( nodeFront ) ) {
@@ -153,19 +159,18 @@ const InspectorOverlay = Class(
153
159
} ,
154
160
155
161
createDataIcon : function ( element ) {
156
- Trace . sysout ( "InspectorOverlay.createDataIcon; " , element ) ;
162
+ if ( ! element . classList . contains ( "editor" ) ) {
163
+ element = element . querySelector ( ".tag-line .editor" ) ;
164
+ }
157
165
166
+ // Bail out if the icon is already created.
158
167
let icon = element . querySelector ( ".fireQueryData" ) ;
159
168
if ( icon ) {
160
169
return ;
161
170
}
162
171
163
- if ( ! element . classList . contains ( "editor" ) ) {
164
- element = element . querySelector ( ".tag-line .editor" ) ;
165
- }
166
-
167
- // Create a little icon indicating the the node (displayed in the
168
- // Markup View) has jQuery data associated. Clicking the icon
172
+ // Create a little icon indicating that the node (displayed in the
173
+ // MarkupView) has jQuery.data associated. Clicking the icon
169
174
// displays the data as an expandable tree in a tooltip.
170
175
let doc = element . ownerDocument ;
171
176
icon = doc . createElementNS ( XHTML_NS , "span" ) ;
@@ -178,14 +183,15 @@ const InspectorOverlay = Class(
178
183
} ,
179
184
180
185
removeDataIcon : function ( element ) {
181
- Trace . sysout ( "InspectorOverlay.removeDataIcon;" , element ) ;
186
+ if ( ! element . classList . contains ( "editor" ) ) {
187
+ element = element . querySelector ( ".tag-line .editor" ) ;
188
+ }
182
189
190
+ // Bail out if the icon doesn't exist.
183
191
let icon = element . querySelector ( ".fireQueryData" ) ;
184
- if ( ! icon ) {
185
- return ;
192
+ if ( icon ) {
193
+ icon . remove ( ) ;
186
194
}
187
-
188
- icon . remove ( ) ;
189
195
} ,
190
196
191
197
onClickTooltip : function ( event ) {
@@ -256,7 +262,11 @@ const InspectorOverlay = Class(
256
262
257
263
front . on ( "data-modified" , this . onDataModified ) ;
258
264
259
- // Update the markup view
265
+ // Update the markup view. It might happen that the backend
266
+ // registration is done after the panel is already displayed.
267
+ // To improve the first-time experience - the panel is auto
268
+ // refreshed so, all jQuery.data indicators are properly
269
+ // rendered within the panel.
260
270
// xxxHonza: request better API (e.g. this.panel.refresh());
261
271
this . panel . onNewRoot ( ) ;
262
272
} ,
@@ -275,10 +285,11 @@ const InspectorOverlay = Class(
275
285
let client = this . toolbox . target . client ;
276
286
let nodeFront = nodeData . node ;
277
287
278
- // The container doesn't have to be always there ( visible) .
288
+ // The container doesn't have to be always visible/available .
279
289
let container = markupView . getContainer ( nodeFront ) ;
280
290
if ( ! container ) {
281
- Trace . sysout ( "InspectorOverlay.onDataModified; No Container" , nodeData ) ;
291
+ Trace . sysout ( "InspectorOverlay.onDataModified; no container, " +
292
+ "has data: " + hasJQueryData ) ;
282
293
return ;
283
294
}
284
295
0 commit comments