Bug 1356873 - Insert inline text nodes between open and close tags; r=gl draft
authorPatrick Brosset <pbrosset@mozilla.com>
Sun, 16 Apr 2017 18:11:14 +0200
changeset 563368 ca64ab2e20a77a828dd8da126ff2bfeb13032d88
parent 563335 ce69b6e1773e9e0d0a190ce899f34b1658e66ca4
child 624445 18c248239564111f3ec5baff81220bebb9af2bbb
push id54268
push userbmo:pbrosset@mozilla.com
push dateSun, 16 Apr 2017 16:13:27 +0000
reviewersgl
bugs1356873
milestone55.0a1
Bug 1356873 - Insert inline text nodes between open and close tags; r=gl MozReview-Commit-ID: 9bWm0EP7Wrp
devtools/client/inspector/markup/test/browser_markup_textcontent_display.js
devtools/client/inspector/markup/views/element-editor.js
--- 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 () {