OLD | NEW |
1 <html> | 1 <html> |
2 <body> | 2 <body> |
3 <script type="text/javascript"> | 3 <script src="devtools.js"></script> |
4 // The function below is executed in the context of the inspected page. | |
5 var page_getProperties = function() { | |
6 var data = window.jQuery && $0 ? jQuery.data($0) : {}; | |
7 // Make a shallow copy with a null prototype, so that sidebar does not | |
8 // expose prototype. | |
9 var props = Object.getOwnPropertyNames(data); | |
10 var copy = { __proto__: null }; | |
11 for (var i = 0; i < props.length; ++i) | |
12 copy[props[i]] = data[props[i]]; | |
13 return copy; | |
14 } | |
15 | |
16 chrome.devtools.panels.elements.createSidebarPane( | |
17 "jQuery Properties", | |
18 function(sidebar) { | |
19 function updateElementProperties() { | |
20 sidebar.setExpression("(" + page_getProperties.toString() + ")()"); | |
21 } | |
22 updateElementProperties(); | |
23 chrome.devtools.panels.elements.onSelectionChanged.addListener( | |
24 updateElementProperties); | |
25 }); | |
26 </script> | |
27 </body> | 4 </body> |
28 </html> | 5 </html> |
OLD | NEW |