Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Issue 5859 (Delete "element.style" is broken)

  • Loading branch information...
commit d82a7643780e691c26a2c3a15b828353364e54f9 1 parent 555d229
Sebastian Zartner authored August 23, 2012
22  extension/content/firebug/css/cssModule.js
@@ -87,15 +87,27 @@ Firebug.CSSModule = Obj.extend(Obj.extend(Firebug.Module, Firebug.EditorSelector
87 87
         return insertIndex;
88 88
     },
89 89
 
90  
-    deleteRule: function(styleSheet, ruleIndex)
  90
+    deleteRule: function(src, ruleIndex)
91 91
     {
92 92
         if (FBTrace.DBG_CSS)
93  
-            FBTrace.sysout("deleteRule: " + ruleIndex + " " + styleSheet.cssRules.length,
94  
-                styleSheet.cssRules);
  93
+        {
  94
+            if (src instanceof window.Element)
  95
+            {
  96
+                FBTrace.sysout("deleteRule: " + ruleIndex + " " + src.cssRules.length,
  97
+                    styleSheet.cssRules);
  98
+            }
  99
+            else
  100
+            {
  101
+                FBTrace.sysout("deleteRule: element.style", src);
  102
+            }
  103
+        }
95 104
 
96  
-        Events.dispatch(this.fbListeners, "onCSSDeleteRule", [styleSheet, ruleIndex]);
  105
+        Events.dispatch(this.fbListeners, "onCSSDeleteRule", [src, ruleIndex]);
97 106
 
98  
-        styleSheet.deleteRule(ruleIndex);
  107
+        if (src instanceof window.Element)
  108
+            src.removeAttribute("style");
  109
+        else
  110
+            src.deleteRule(ruleIndex);
99 111
     },
100 112
 
101 113
     setProperty: function(rule, propName, propValue, propPriority)
14  extension/content/firebug/css/cssPanel.js
@@ -1582,17 +1582,9 @@ Firebug.CSSStyleSheetPanel.prototype = Obj.extend(Firebug.Panel,
1582 1582
 
1583 1583
         CSSModule.deleteRule(styleSheet, ruleIndex);
1584 1584
 
1585  
-        if (this.context.panelName == "stylesheet")
1586  
-        {
1587  
-            var rule = Dom.getAncestorByClass(cssSelector, "cssRule");
1588  
-            if (rule)
1589  
-                rule.parentNode.removeChild(rule);
1590  
-        }
1591  
-        else
1592  
-        {
1593  
-            var sidePanel = Firebug.chrome.getSelectedSidePanel();
1594  
-            sidePanel.refresh();
1595  
-        }
  1585
+        var rule = Dom.getAncestorByClass(cssSelector, "cssRule");
  1586
+        if (rule)
  1587
+            rule.parentNode.removeChild(rule);
1596 1588
     },
1597 1589
 
1598 1590
     copyStyleDeclaration: function(cssSelector)
17  extension/content/firebug/css/stylePanel.js
@@ -682,6 +682,23 @@ CSSStylePanel.prototype = Obj.extend(CSSStyleSheetPanel.prototype,
682 682
         return CSSStyleSheetPanel.prototype.showInfoTip.call(this, infoTip, target, x, y, rangeParent, rangeOffset);
683 683
     },
684 684
 
  685
+    // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
  686
+    // Extends stylesheet (CSS Panel)
  687
+
  688
+    deleteRuleDeclaration: function(cssSelector)
  689
+    {
  690
+        var repObject = Firebug.getRepObject(cssSelector);
  691
+
  692
+        if (repObject instanceof window.Element)
  693
+            CSSModule.deleteRule(repObject);
  694
+        else
  695
+            CSSStyleSheetPanel.prototype.deleteRuleDeclaration(cssSelector);
  696
+
  697
+        this.refresh();
  698
+    },
  699
+
  700
+    // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
  701
+
685 702
     hasPseudoClassLock: function(pseudoClass)
686 703
     {
687 704
         if (Dom.domUtils.hasPseudoClassLock)

0 notes on commit d82a764

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