REGRESSION: Web Inspector: Exception showing the DOM tree for a node with too many...
[WebKit-https.git] / Source / WebInspectorUI / UserInterface / Views / TreeOutline.js
index fff1db7c0ef20c1f116cb0a35a05d3b3074a4c38..e71a6325a8d5e30c40b0546eed42101d32facbd0 100644 (file)
@@ -85,8 +85,15 @@ TreeOutline.prototype.appendChild = function(child)
     if (child.hasChildren && child.treeOutline._treeElementsExpandedState[child.identifier] !== undefined)
         child.expanded = child.treeOutline._treeElementsExpandedState[child.identifier];
 
-    if (this._childrenListNode)
-        child._attach();
+    if (!this._childrenListNode) {
+        this._childrenListNode = this.treeOutline._childrenListNode.ownerDocument.createElement("ol");
+        this._childrenListNode.parentTreeElement = this;
+        this._childrenListNode.classList.add("children");
+        if (this.hidden)
+            this._childrenListNode.classList.add("hidden");
+    }
+
+    child._attach();
 
     if (this.treeOutline.onadd)
         this.treeOutline.onadd(child);
@@ -134,8 +141,15 @@ TreeOutline.prototype.insertChild = function(child, index)
     if (child.hasChildren && child.treeOutline._treeElementsExpandedState[child.identifier] !== undefined)
         child.expanded = child.treeOutline._treeElementsExpandedState[child.identifier];
 
-    if (this._childrenListNode)
-        child._attach();
+    if (!this._childrenListNode) {
+        this._childrenListNode = this.treeOutline._childrenListNode.ownerDocument.createElement("ol");
+        this._childrenListNode.parentTreeElement = this;
+        this._childrenListNode.classList.add("children");
+        if (this.hidden)
+            this._childrenListNode.classList.add("hidden");
+    }
+
+    child._attach();
 
     if (this.treeOutline.onadd)
         this.treeOutline.onadd(child);