Skip to content
Permalink
Browse files
Web Inspector: Elements Tab: don't show the Target in the Event badge…
… popover

https://bugs.webkit.org/show_bug.cgi?id=244645

Reviewed by Patrick Angle.

The Event badge popover only shows event listeners attached directly on the related DOM node, so
there's no reason to show the Target as it'll always be that same DOM node.

* Source/WebInspectorUI/UserInterface/Views/DOMTreeElement.js:
(WI.DOMTreeElement.prototype.async _handleEventBadgeClicked):
Explicitly `hideTarget: true`.

* Source/WebInspectorUI/UserInterface/Views/EventListenerSectionGroup.js:
(WI.EventListenerSectionGroup.groupIntoSectionsByEvent):
(WI.EventListenerSectionGroup.groupIntoSectionsByTarget):
Allow `options = {}` to be given to the `static` helper methods, which pipe to the `WI.EventListenerSectionGroup`.

Canonical link: https://commits.webkit.org/254018@main
  • Loading branch information
dcrousso committed Sep 1, 2022
1 parent ded49fa commit 2a5a5c3fa186d352861bc319816cff5ea7b59a7a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
@@ -2122,7 +2122,7 @@ WI.DOMTreeElement = class DOMTreeElement extends WI.TreeElement
popover.present(calculateTargetFrame(), preferredEdges, {updateContent: true, shouldAnimate: false});
};

let sections = WI.EventListenerSectionGroup.groupIntoSectionsByEvent(listeners);
let sections = WI.EventListenerSectionGroup.groupIntoSectionsByEvent(listeners, {hideTarget: true});
for (let section of sections) {
section.addEventListener(WI.DetailsSection.Event.CollapsedStateChanged, function(event) {
const shouldAnimate = false;
@@ -108,7 +108,7 @@ WI.EventListenerSectionGroup = class EventListenerSectionGroup extends WI.Detail

// Static

static groupIntoSectionsByEvent(eventListeners)
static groupIntoSectionsByEvent(eventListeners, options = {})
{
let eventListenerTypes = new Map;
for (let eventListener of eventListeners) {
@@ -127,12 +127,12 @@ WI.EventListenerSectionGroup = class EventListenerSectionGroup extends WI.Detail
let types = Array.from(eventListenerTypes.keys());
types.sort();
for (let type of types)
rows.push(WI.EventListenerSectionGroup._createEventListenerSection(type, eventListenerTypes.get(type), {hideType: true}));
rows.push(WI.EventListenerSectionGroup._createEventListenerSection(type, eventListenerTypes.get(type), {...options, hideType: true}));

return rows;
}

static groupIntoSectionsByTarget(eventListeners, domNode)
static groupIntoSectionsByTarget(eventListeners, domNode, options = {})
{
const windowTargetIdentifier = Symbol("window");

@@ -161,7 +161,7 @@ WI.EventListenerSectionGroup = class EventListenerSectionGroup extends WI.Detail
let title = target === windowTargetIdentifier ? WI.unlocalizedString("window") : target.displayName;
let identifier = target === windowTargetIdentifier ? WI.unlocalizedString("window") : target.unescapedSelector;

let section = WI.EventListenerSectionGroup._createEventListenerSection(title, eventListenersForTarget, {hideTarget: true, identifier});
let section = WI.EventListenerSectionGroup._createEventListenerSection(title, eventListenersForTarget, {...options, hideTarget: true, identifier});
if (target instanceof WI.DOMNode)
WI.bindInteractionsForNodeToElement(target, section.titleElement, {ignoreClick: true});
rows.push(section);

0 comments on commit 2a5a5c3

Please sign in to comment.