commit 397df9e04648e3598e4e4052b6a2653ff64957b3
parent 1bfdebd5b9ce46f26d83b25bb3ae177573a12235
Author: Lorenz A <me@lorenzackermann.xyz>
Date: Mon, 15 Dec 2025 09:24:50 +0000
Bug 2004279 - [devtools] Turn devtools/client/inspector/markup/views/text-container.js into an ES class. r=devtools-reviewers,nchevobbe
Differential Revision: https://phabricator.services.mozilla.com/D276125
Diffstat:
1 file changed, 19 insertions(+), 25 deletions(-)
diff --git a/devtools/client/inspector/markup/views/text-container.js b/devtools/client/inspector/markup/views/text-container.js
@@ -7,38 +7,32 @@
const nodeConstants = require("resource://devtools/shared/dom-node-constants.js");
const TextEditor = require("resource://devtools/client/inspector/markup/views/text-editor.js");
const MarkupContainer = require("resource://devtools/client/inspector/markup/views/markup-container.js");
-const { extend } = require("resource://devtools/shared/extend.js");
/**
* An implementation of MarkupContainer for text node and comment nodes.
* Allows basic text editing in a textarea.
- *
- * @param {MarkupView} markupView
- * The markup view that owns this container.
- * @param {NodeFront} node
- * The node to display.
- * @param {Inspector} inspector
- * The inspector tool container the markup-view
*/
-function MarkupTextContainer(markupView, node) {
- MarkupContainer.prototype.initialize.call(
- this,
- markupView,
- node,
- "textcontainer"
- );
+class MarkupTextContainer extends MarkupContainer {
+ /**
+ * @param {MarkupView} markupView
+ * The markup view that owns this container.
+ * @param {NodeFront} node
+ * The node to display.
+ */
+ constructor(markupView, node) {
+ super();
+ this.initialize(markupView, node, "textcontainer");
- if (node.nodeType == nodeConstants.TEXT_NODE) {
- this.editor = new TextEditor(this, node, "text");
- } else if (node.nodeType == nodeConstants.COMMENT_NODE) {
- this.editor = new TextEditor(this, node, "comment");
- } else {
- throw new Error("Invalid node for MarkupTextContainer");
- }
+ if (node.nodeType == nodeConstants.TEXT_NODE) {
+ this.editor = new TextEditor(this, node, "text");
+ } else if (node.nodeType == nodeConstants.COMMENT_NODE) {
+ this.editor = new TextEditor(this, node, "comment");
+ } else {
+ throw new Error("Invalid node for MarkupTextContainer");
+ }
- this.tagLine.appendChild(this.editor.elt);
+ this.tagLine.appendChild(this.editor.elt);
+ }
}
-MarkupTextContainer.prototype = extend(MarkupContainer.prototype, {});
-
module.exports = MarkupTextContainer;