Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Allow temporary invalid values in selector editing

Broken by issue 5862 (Crop long CSS values in Style side panel).
  • Loading branch information...
commit e006bec727b1147bd3433721ed8fbd736a8616c6 1 parent 3c90164
@simonlindholm simonlindholm authored
Showing with 16 additions and 24 deletions.
  1. +16 −24 extension/content/firebug/css/cssPanel.js
View
40 extension/content/firebug/css/cssPanel.js
@@ -1754,8 +1754,7 @@ CSSEditor.prototype = domplate(Firebug.InlineEditor.prototype,
}
else if (Dom.getAncestorByClass(target, "cssPropValue"))
{
- var limit = Options.get("stringCropLength");
- target.textContent = limit > 0 ? Str.cropString(value, limit) : value;
+ target.textContent = CSSDomplateBase.getPropertyValue({value: value});
propName = Dom.getChildByClass(row, "cssPropName").textContent;
propValue = Dom.getChildByClass(row, "cssPropValue").textContent;
@@ -2291,7 +2290,6 @@ CSSRuleEditor.prototype = domplate(Firebug.InlineEditor.prototype,
return;
var row = Dom.getAncestorByClass(target, "cssRule");
-
var rule = Firebug.getRepObject(target);
var searchRule = rule || Firebug.getRepObject(row.nextSibling);
@@ -2342,6 +2340,14 @@ CSSRuleEditor.prototype = domplate(Firebug.InlineEditor.prototype,
ruleIndex = cssRules.length;
}
+ // Delete in all cases except for new add
+ // We want to do this before the insert to ease change tracking
+ if (oldRule)
+ {
+ CSSModule.deleteRule(styleSheet, ruleIndex);
+ }
+
+ var doMarkChange = true;
// Firefox does not follow the spec for the update selector text case.
// When attempting to update the value, firefox will silently fail.
@@ -2360,24 +2366,14 @@ CSSRuleEditor.prototype = domplate(Firebug.InlineEditor.prototype,
if (!Css.hasClass(propEl, "disabledStyle"))
{
var propName = Dom.getChildByClass(propEl, "cssPropName").textContent;
- cssText.push(propName);
- cssText.push(":");
- cssText.push(rule.style.getPropertyValue(propName) +
- (rule.style.getPropertyPriority(propName) ? " !important" : ""));
- cssText.push(";");
+ var propValue = Dom.getChildByClass(propEl, "cssPropValue").repObject;
+ cssText.push(propName + ":" + propValue + ";");
}
}
cssText.push("}");
cssText = cssText.join("");
- // Delete in all cases except for new add
- // We want to do this before the insert to ease change tracking
- if (oldRule)
- {
- CSSModule.deleteRule(styleSheet, ruleIndex);
- }
-
try
{
var insertLoc = CSSModule.insertRule(styleSheet, cssText, ruleIndex);
@@ -2408,28 +2404,24 @@ CSSRuleEditor.prototype = domplate(Firebug.InlineEditor.prototype,
this.box.setAttribute('saveSuccess', false);
- row.repObject = rule;
- return;
+ doMarkChange = false;
}
}
else
{
- if (oldRule)
- {
- CSSModule.deleteRule(styleSheet, ruleIndex);
- }
+ // XXX There is currently no way to re-add the rule after this happens.
rule = undefined;
}
// Update the rep object
row.repObject = rule;
- if (oldRule)
+ if (oldRule && rule)
this.panel.remapRule(context, oldRule, rule);
- this.panel.markChange(this.panel.name == "stylesheet");
+ if (doMarkChange)
+ this.panel.markChange(this.panel.name == "stylesheet");
},
-
getAutoCompleteRange: function(value, offset)
{
if (!Css.hasClass(this.target, "cssSelector"))
Please sign in to comment.
Something went wrong with that request. Please try again.