From 13da56e791b7478ad3dbb8162a583a6b2c8c4b6b Mon Sep 17 00:00:00 2001 From: Eric Guzman Date: Fri, 18 May 2012 17:27:31 -0700 Subject: Style Declaration - Handle removing styles Removed sorting and had to put a null check in the style component because the valueText was being set to undefined and causing an error. Check with montage on why that is happening. --- js/panels/css-panel/styles-view-delegate.js | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'js/panels/css-panel/styles-view-delegate.js') diff --git a/js/panels/css-panel/styles-view-delegate.js b/js/panels/css-panel/styles-view-delegate.js index 38b0fcc6..b5efc18c 100644 --- a/js/panels/css-panel/styles-view-delegate.js +++ b/js/panels/css-panel/styles-view-delegate.js @@ -145,14 +145,16 @@ exports.StylesViewMediator = Montage.create(Component, { return false; } + ///// Remove old property + this.stylesController.deleteStyle(rule, oldProperty); + if(property === '') { - style.remove(); + style.parentComponent.parentComponent.removeStyle(style.source); this._dispatchChange(oldProperty, browserValue); return false; } - ///// Remove old property and add new one - this.stylesController.deleteStyle(rule, oldProperty); + // now add new property browserValue = this.stylesController.setStyle(rule, property, value); ///// Mark style as invalid if the browser doesn't accept it @@ -166,7 +168,9 @@ exports.StylesViewMediator = Montage.create(Component, { var browserValue, units; if(value === '') { - style.remove(); + ///// Remove old property + this.stylesController.deleteStyle(rule, property); + style.parentComponent.parentComponent.removeStyle(style.source); this._dispatchChange(property, browserValue); return false; } -- cgit v1.2.3