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