Bug 1356873 - Insert inline text nodes between open and close tags; r=gl
MozReview-Commit-ID: 9bWm0EP7Wrp
--- a/devtools/client/inspector/markup/test/browser_markup_textcontent_display.js
+++ b/devtools/client/inspector/markup/test/browser_markup_textcontent_display.js
@@ -70,16 +70,20 @@ function* checkNode(inspector, testActor
is(!!container.inlineTextChild, inline, "Container inlineTextChild is as expected");
is(!container.canExpand, inline, "Container canExpand property is as expected");
let textContainer;
if (inline) {
textContainer = container.elt.querySelector("pre");
ok(!!textContainer, "Text container is already rendered for inline text elements");
+ ok(textContainer.parentNode.previousSibling.classList.contains("open"),
+ "Text container is after the open tag");
+ ok(textContainer.parentNode.nextSibling.classList.contains("close"),
+ "Text container is before the close tag");
} else {
textContainer = container.elt.querySelector("pre");
ok(!textContainer, "Text container is not rendered for collapsed text nodes");
yield inspector.markup.expandNode(container.node);
yield waitForMultipleChildrenUpdates(inspector);
textContainer = container.elt.querySelector("pre");
ok(!!textContainer, "Text container is rendered after expanding the container");
--- a/devtools/client/inspector/markup/views/element-editor.js
+++ b/devtools/client/inspector/markup/views/element-editor.js
@@ -266,18 +266,17 @@ ElementEditor.prototype = {
this.textEditor = null;
}
if (node && !this.textEditor) {
// Create a text editor added to this editor.
// This editor won't receive an update automatically, so we rely on
// child text editors to let us know that we need updating.
this.textEditor = new TextEditor(this.container, node, "text");
- this.elt.insertBefore(this.textEditor.elt,
- this.elt.firstChild.nextSibling.nextSibling);
+ this.elt.insertBefore(this.textEditor.elt, this.elt.querySelector(".close"));
}
if (this.textEditor) {
this.textEditor.update();
}
},
_startModifyingAttributes: function () {