Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Issue 5849: HTML panel visibility updates should affect children

  • Loading branch information...
commit ca693d45350769df770903a86878c0d54474c34c 1 parent c35f687
Simon Lindholm authored August 21, 2012
29  extension/content/firebug/html/htmlPanel.js
@@ -346,6 +346,30 @@ Firebug.HTMLPanel.prototype = Obj.extend(WalkingPanel,
346 346
             null : ["link", "script", "style"]);
347 347
     },
348 348
 
  349
+    updateNodeVisibility: function(node)
  350
+    {
  351
+        var wasHidden = node.classList.contains("nodeHidden");
  352
+        if (!Xml.isVisible(node.repObject))
  353
+        {
  354
+            // Hide this node and, through CSS, every descendant.
  355
+            node.classList.add("nodeHidden");
  356
+        }
  357
+        else if (wasHidden)
  358
+        {
  359
+            // The node has changed state from hidden to shown. While in the
  360
+            // hidden state, some descendants may have been explicitly marked
  361
+            // with .nodeHidden (not just through CSS inheritance), so we need
  362
+            // to recheck the visibility of those.
  363
+            node.classList.remove("nodeHidden");
  364
+            var desc = Arr.cloneArray(node.getElementsByClassName("nodeHidden"));
  365
+            for (var i = 0; i < desc.length; ++i)
  366
+            {
  367
+                if (Xml.isVisible(desc[i].repObject))
  368
+                    desc[i].classList.remove("nodeHidden");
  369
+            }
  370
+        }
  371
+    },
  372
+
349 373
     // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
350 374
 
351 375
     getElementSourceText: function(node)
@@ -479,10 +503,7 @@ Firebug.HTMLPanel.prototype = Obj.extend(WalkingPanel,
479 503
         if (!objectNodeBox)
480 504
             return;
481 505
 
482  
-        if (Xml.isVisible(objectNodeBox.repObject))
483  
-            Css.removeClass(objectNodeBox, "nodeHidden");
484  
-        else
485  
-            Css.setClass(objectNodeBox, "nodeHidden");
  506
+        this.updateNodeVisibility(objectNodeBox);
486 507
 
487 508
         if (attrChange == MODIFICATION || attrChange == ADDITION)
488 509
         {
6  extension/content/firebug/lib/array.js
@@ -91,13 +91,13 @@ Arr.sliceArray = function(array, index)
91 91
 
92 92
 Arr.cloneArray = function(array, fn)
93 93
 {
94  
-   var newArray = [];
  94
+   var newArray = [], len = array.length;
95 95
 
96 96
    if (fn)
97  
-       for (var i = 0; i < array.length; ++i)
  97
+       for (var i = 0; i < len; ++i)
98 98
            newArray.push(fn(array[i]));
99 99
    else
100  
-       for (var i = 0; i < array.length; ++i)
  100
+       for (var i = 0; i < len; ++i)
101 101
            newArray.push(array[i]);
102 102
 
103 103
    return newArray;

0 notes on commit ca693d4

Please sign in to comment.
Something went wrong with that request. Please try again.