Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(523)

Side by Side Diff: Source/devtools/front_end/elements/EventListenersWidget.js

Issue 1268353005: [DevTools] Support JQuery event listeners (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2007 Apple Inc. All rights reserved. 2 * Copyright (C) 2007 Apple Inc. All rights reserved.
3 * Copyright (C) 2009 Joseph Pecoraro 3 * Copyright (C) 2009 Joseph Pecoraro
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 8 *
9 * 1. Redistributions of source code must retain the above copyright 9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 20 matching lines...) Expand all
31 * @constructor 31 * @constructor
32 * @extends {WebInspector.ThrottledWidget} 32 * @extends {WebInspector.ThrottledWidget}
33 */ 33 */
34 WebInspector.EventListenersWidget = function() 34 WebInspector.EventListenersWidget = function()
35 { 35 {
36 WebInspector.ThrottledWidget.call(this); 36 WebInspector.ThrottledWidget.call(this);
37 this.element.classList.add("events-pane"); 37 this.element.classList.add("events-pane");
38 38
39 this._showForAncestorsSetting = WebInspector.settings.createSetting("showEve ntListenersForAncestors", true); 39 this._showForAncestorsSetting = WebInspector.settings.createSetting("showEve ntListenersForAncestors", true);
40 this._showForAncestorsSetting.addChangeListener(this.update.bind(this)); 40 this._showForAncestorsSetting.addChangeListener(this.update.bind(this));
41 this._showFrameworkListenersSetting = WebInspector.settings.createSetting("s howFrameowkrListeners", true);
42 this._showFrameworkListenersSetting.addChangeListener(this._showFrameworkLis tenersChanged.bind(this));
41 this._eventListenersView = new WebInspector.EventListenersView(this.element) ; 43 this._eventListenersView = new WebInspector.EventListenersView(this.element) ;
42 WebInspector.context.addFlavorChangeListener(WebInspector.DOMNode, this.upda te, this); 44 WebInspector.context.addFlavorChangeListener(WebInspector.DOMNode, this.upda te, this);
43 } 45 }
44 46
45 /** 47 /**
46 * @return {!WebInspector.ElementsSidebarViewWrapperPane} 48 * @return {!WebInspector.ElementsSidebarViewWrapperPane}
47 */ 49 */
48 WebInspector.EventListenersWidget.createSidebarWrapper = function() 50 WebInspector.EventListenersWidget.createSidebarWrapper = function()
49 { 51 {
50 var widget = new WebInspector.EventListenersWidget(); 52 var widget = new WebInspector.EventListenersWidget();
51 var result = new WebInspector.ElementsSidebarViewWrapperPane(WebInspector.UI String("Event Listeners"), widget); 53 var result = new WebInspector.ElementsSidebarViewWrapperPane(WebInspector.UI String("Event Listeners"), widget);
52 var refreshButton = new WebInspector.ToolbarButton(WebInspector.UIString("Re fresh"), "refresh-toolbar-item"); 54 var refreshButton = new WebInspector.ToolbarButton(WebInspector.UIString("Re fresh"), "refresh-toolbar-item");
53 refreshButton.addEventListener("click", widget.update.bind(widget)); 55 refreshButton.addEventListener("click", widget.update.bind(widget));
54 result.toolbar().appendToolbarItem(refreshButton); 56 result.toolbar().appendToolbarItem(refreshButton);
55 result.toolbar().appendToolbarItem(new WebInspector.ToolbarCheckbox(WebInspe ctor.UIString("Ancestors"), WebInspector.UIString("Show listeners on the ancesto rs"), widget._showForAncestorsSetting)); 57 result.toolbar().appendToolbarItem(new WebInspector.ToolbarCheckbox(WebInspe ctor.UIString("Ancestors"), WebInspector.UIString("Show listeners on the ancesto rs"), widget._showForAncestorsSetting));
58 result.toolbar().appendToolbarItem(new WebInspector.ToolbarCheckbox(WebInspe ctor.UIString("Framework listeners"), WebInspector.UIString("Resolve event liste ners bound with framework"), widget._showFrameworkListenersSetting));
56 return result; 59 return result;
57 } 60 }
58 61
59 WebInspector.EventListenersWidget._objectGroupName = "event-listeners-panel"; 62 WebInspector.EventListenersWidget._objectGroupName = "event-listeners-panel";
60 63
61 WebInspector.EventListenersWidget.prototype = { 64 WebInspector.EventListenersWidget.prototype = {
62 /** 65 /**
63 * @override 66 * @override
64 * @protected 67 * @protected
65 * @return {!Promise.<?>} 68 * @return {!Promise.<?>}
(...skipping 16 matching lines...) Expand all
82 var listenersView = this._eventListenersView; 85 var listenersView = this._eventListenersView;
83 promises.push(node.resolveToObjectPromise(WebInspector.EventListenersWid get._objectGroupName)); 86 promises.push(node.resolveToObjectPromise(WebInspector.EventListenersWid get._objectGroupName));
84 if (!selectedNodeOnly) { 87 if (!selectedNodeOnly) {
85 var currentNode = node.parentNode; 88 var currentNode = node.parentNode;
86 while (currentNode) { 89 while (currentNode) {
87 promises.push(currentNode.resolveToObjectPromise(WebInspector.Ev entListenersWidget._objectGroupName)); 90 promises.push(currentNode.resolveToObjectPromise(WebInspector.Ev entListenersWidget._objectGroupName));
88 currentNode = currentNode.parentNode; 91 currentNode = currentNode.parentNode;
89 } 92 }
90 promises.push(this._windowObjectInNodeContext(node)); 93 promises.push(this._windowObjectInNodeContext(node));
91 } 94 }
92 return Promise.all(promises).then(this._eventListenersView.addObjects.bi nd(this._eventListenersView)); 95 return Promise.all(promises).then(this._eventListenersView.addObjects.bi nd(this._eventListenersView)).then(this._showFrameworkListenersChanged.bind(this ));
96 },
97
98
99 _showFrameworkListenersChanged: function()
100 {
101 this._eventListenersView.showFrameworkListeners(this._showFrameworkListe nersSetting.get());
93 }, 102 },
94 103
95 /** 104 /**
96 * @param {!WebInspector.DOMNode} node 105 * @param {!WebInspector.DOMNode} node
97 * @return {!Promise<!WebInspector.RemoteObject>} 106 * @return {!Promise<!WebInspector.RemoteObject>}
98 */ 107 */
99 _windowObjectInNodeContext: function(node) 108 _windowObjectInNodeContext: function(node)
100 { 109 {
101 return new Promise(windowObjectInNodeContext); 110 return new Promise(windowObjectInNodeContext);
102 111
(...skipping 17 matching lines...) Expand all
120 context.evaluate("self", WebInspector.EventListenersWidget._objectGr oupName, false, true, false, false, fulfill); 129 context.evaluate("self", WebInspector.EventListenersWidget._objectGr oupName, false, true, false, false, fulfill);
121 } 130 }
122 }, 131 },
123 132
124 _eventListenersArrivedForTest: function() 133 _eventListenersArrivedForTest: function()
125 { 134 {
126 }, 135 },
127 136
128 __proto__: WebInspector.ThrottledWidget.prototype 137 __proto__: WebInspector.ThrottledWidget.prototype
129 } 138 }
OLDNEW
« no previous file with comments | « Source/devtools/front_end/components/module.json ('k') | Source/devtools/front_end/platform/utilities.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698