tor-browser

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

commit 0897c305401cacf6aaf165d10985fdddeed869d7
parent 37598e5e07b1c1dd4d9a1726d9c8735e4e52be17
Author: Lorenz A <me@lorenzackermann.xyz>
Date:   Fri, 12 Dec 2025 09:24:43 +0000

Bug 2004283 - [devtools] Turn devtools/client/inspector/markup/views/read-only-editor.js into an ES class. r=devtools-reviewers,jdescottes

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

Diffstat:
Mdevtools/client/inspector/markup/views/read-only-editor.js | 47+++++++++++++++++++++++------------------------
1 file changed, 23 insertions(+), 24 deletions(-)

diff --git a/devtools/client/inspector/markup/views/read-only-editor.js b/devtools/client/inspector/markup/views/read-only-editor.js @@ -9,28 +9,27 @@ const nodeConstants = require("resource://devtools/shared/dom-node-constants.js" /** * Creates an editor for non-editable nodes. */ -function ReadOnlyEditor(container, nodeFront) { - this.container = container; - this.markup = this.container.markup; - this.buildMarkup(); +class ReadOnlyEditor { + constructor(container, nodeFront) { + this.container = container; + this.markup = this.container.markup; + this.buildMarkup(); - if (nodeFront.nodeType == nodeConstants.DOCUMENT_TYPE_NODE) { - this.elt.classList.add("comment", "doctype"); - this.tag.textContent = nodeFront.doctypeString; - } else if (nodeFront.isShadowRoot) { - this.tag.textContent = `#shadow-root (${nodeFront.shadowRootMode})`; - } else { - this.tag.textContent = nodeFront.displayName; - if (nodeFront.isPseudoElement) { - this.tag.classList.add("pseudo", "force-color-on-flash"); + if (nodeFront.nodeType == nodeConstants.DOCUMENT_TYPE_NODE) { + this.elt.classList.add("comment", "doctype"); + this.tag.textContent = nodeFront.doctypeString; + } else if (nodeFront.isShadowRoot) { + this.tag.textContent = `#shadow-root (${nodeFront.shadowRootMode})`; + } else { + this.tag.textContent = nodeFront.displayName; + if (nodeFront.isPseudoElement) { + this.tag.classList.add("pseudo", "force-color-on-flash"); + } } - } - - // Make the "tag" part of this editor focusable. - this.tag.setAttribute("tabindex", "-1"); -} -ReadOnlyEditor.prototype = { + // Make the "tag" part of this editor focusable. + this.tag.setAttribute("tabindex", "-1"); + } buildMarkup() { const doc = this.markup.doc; @@ -40,7 +39,7 @@ ReadOnlyEditor.prototype = { this.tag = doc.createElement("span"); this.tag.classList.add("tag"); this.elt.appendChild(this.tag); - }, + } destroy() { // We might be already destroyed. @@ -51,7 +50,7 @@ ReadOnlyEditor.prototype = { this.elt.remove(); this.elt = null; this.tag = null; - }, + } /** * Show overflow highlight if showOverflowHighlight is true, otherwise hide it. @@ -63,14 +62,14 @@ ReadOnlyEditor.prototype = { "overflow-causing-highlighted", showOverflowHighlight ); - }, + } /** * Stub method for consistency with ElementEditor. */ getInfoAtNode() { return null; - }, -}; + } +} module.exports = ReadOnlyEditor;