tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

commit 2ac07f435839ad86573fa2d8a14547215433cf55
parent 9f62a93cb66dc40d3679792cd35be142a9bfbef8
Author: Lorenz A <me@lorenzackermann.xyz>
Date:   Fri, 12 Dec 2025 09:36:52 +0000

Bug 2004281 - [devtools] Turn devtools/client/inspector/markup/views/slotted-node-container.js into an ES class. r=devtools-reviewers,jdescottes

Differential Revision: https://phabricator.services.mozilla.com/D276123

Diffstat:
Mdevtools/client/inspector/markup/views/slotted-node-container.js | 38++++++++++++++++----------------------
1 file changed, 16 insertions(+), 22 deletions(-)

diff --git a/devtools/client/inspector/markup/views/slotted-node-container.js b/devtools/client/inspector/markup/views/slotted-node-container.js @@ -6,22 +6,16 @@ const SlottedNodeEditor = require("resource://devtools/client/inspector/markup/views/slotted-node-editor.js"); const MarkupContainer = require("resource://devtools/client/inspector/markup/views/markup-container.js"); -const { extend } = require("resource://devtools/shared/extend.js"); -function SlottedNodeContainer(markupView, node) { - MarkupContainer.prototype.initialize.call( - this, - markupView, - node, - "slottednodecontainer" - ); +class SlottedNodeContainer extends MarkupContainer { + constructor(markupView, node) { + super(); + super.initialize(markupView, node, "slottednodecontainer"); - this.editor = new SlottedNodeEditor(this, node); - this.tagLine.appendChild(this.editor.elt); - this.hasChildren = false; -} - -SlottedNodeContainer.prototype = extend(MarkupContainer.prototype, { + this.editor = new SlottedNodeEditor(this, node); + this.tagLine.appendChild(this.editor.elt); + this.hasChildren = false; + } _onMouseDown(event) { if (event.target.classList.contains("reveal-link")) { event.stopPropagation(); @@ -29,20 +23,20 @@ SlottedNodeContainer.prototype = extend(MarkupContainer.prototype, { return; } MarkupContainer.prototype._onMouseDown.call(this, event); - }, + } /** * Slotted node containers never display children and should not react to toggle. */ _onToggle(event) { event.stopPropagation(); - }, + } _revealFromSlot() { const reason = "reveal-from-slot"; this.markup.inspector.selection.setNodeFront(this.node, { reason }); Glean.devtoolsShadowdom.revealLinkClicked.set(true); - }, + } _onKeyDown(event) { MarkupContainer.prototype._onKeyDown.call(this, event); @@ -51,7 +45,7 @@ SlottedNodeContainer.prototype = extend(MarkupContainer.prototype, { if (event.target.classList.contains("reveal-link") && isActionKey) { this._revealFromSlot(); } - }, + } async onContainerClick(event) { if (!event.target.classList.contains("reveal-link")) { @@ -59,15 +53,15 @@ SlottedNodeContainer.prototype = extend(MarkupContainer.prototype, { } this._revealFromSlot(); - }, + } isDraggable() { return false; - }, + } isSlotted() { return true; - }, -}); + } +} module.exports = SlottedNodeContainer;