From 041c7e125386c1add7653ec90f5b882ffa82530d Mon Sep 17 00:00:00 2001 From: Eric Guzman Date: Tue, 22 May 2012 15:15:28 -0700 Subject: CSS Panel - Fix applying selector to element when selector not changed --- js/panels/css-panel/styles-view-delegate.js | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) (limited to 'js/panels/css-panel') diff --git a/js/panels/css-panel/styles-view-delegate.js b/js/panels/css-panel/styles-view-delegate.js index 1644460a..5229b92e 100644 --- a/js/panels/css-panel/styles-view-delegate.js +++ b/js/panels/css-panel/styles-view-delegate.js @@ -78,7 +78,6 @@ exports.StylesViewDelegate = Montage.create(Component, { _getClassNameFromSelector : { value: function(selectorText) { var results = /.*\.([A-Za-z0-9_-]+)\:?[A-Za-z0-9_"=-]*$/.exec(selectorText); - return (results) ? results[1] : null; } }, @@ -243,24 +242,16 @@ exports.StylesViewDelegate = Montage.create(Component, { ///// Create the rule with generated selector newRule = this.application.ninja.stylesController.addRule('.'+selector, ' { }'); - ///// Add the generated class to each element in selection - ///// and check whether it applies to the element -// this.ruleListContainer.displayedList.selection.forEach(function(el) { -// this.stylesController.addClass(el, selector); -// -// if(applies) { -// applies = (this._doesSelectorTargetElement('.'+selector, el)); -// } -// },this); - ///// Add rule directly to the rule list this.ruleListContainer.displayedList.component.addRule(newRule, null, applies, function(ruleComponent) { var rC = ruleComponent; + // TODO: use stop event to apply class to element rC.addClassNameOnChange = true; setTimeout(function() { rC.selectorField.start(); + rC.selectorField._preEditValue = ""; },50); }); -- cgit v1.2.3