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 0e4b1351fb3668bcc442bd37c5981f6b439e28fd 1 parent 9ea45e4
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
@@ -1578,17 +1578,9 @@ Firebug.CSSStyleSheetPanel.prototype = Obj.extend(Firebug.Panel,
1578 1578
 
1579 1579
         CSSModule.deleteRule(styleSheet, ruleIndex);
1580 1580
 
1581  
-        if (this.context.panelName == "stylesheet")
1582  
-        {
1583  
-            var rule = Dom.getAncestorByClass(cssSelector, "cssRule");
1584  
-            if (rule)
1585  
-                rule.parentNode.removeChild(rule);
1586  
-        }
1587  
-        else
1588  
-        {
1589  
-            var sidePanel = Firebug.chrome.getSelectedSidePanel();
1590  
-            sidePanel.refresh();
1591  
-        }
  1581
+        var rule = Dom.getAncestorByClass(cssSelector, "cssRule");
  1582
+        if (rule)
  1583
+            rule.parentNode.removeChild(rule);
1592 1584
     },
1593 1585
 
1594 1586
     copyStyleDeclaration: function(cssSelector)
17  extension/content/firebug/css/stylePanel.js
@@ -683,6 +683,23 @@ CSSStylePanel.prototype = Obj.extend(CSSStyleSheetPanel.prototype,
683 683
         return CSSStyleSheetPanel.prototype.showInfoTip.call(this, infoTip, target, x, y, rangeParent, rangeOffset);
684 684
     },
685 685
 
  686
+    // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
  687
+    // Extends stylesheet (CSS Panel)
  688
+
  689
+    deleteRuleDeclaration: function(cssSelector)
  690
+    {
  691
+        var repObject = Firebug.getRepObject(cssSelector);
  692
+
  693
+        if (repObject instanceof window.Element)
  694
+            CSSModule.deleteRule(repObject);
  695
+        else
  696
+            CSSStyleSheetPanel.prototype.deleteRuleDeclaration(cssSelector);
  697
+
  698
+        this.refresh();
  699
+    },
  700
+
  701
+    // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
  702
+
686 703
     hasPseudoClassLock: function(pseudoClass)
687 704
     {
688 705
         if (Dom.domUtils.hasPseudoClassLock)

0 notes on commit 0e4b135

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