Browse Source

Update `clear` in CssComposer, remove also the wrapper style

pull/600/head
Artur Arseniev 9 years ago
parent
commit
21221a29e3
  1. 4
      src/css_composer/index.js
  2. 8
      src/css_composer/view/CssRulesView.js

4
src/css_composer/index.js

@ -240,10 +240,8 @@ module.exports = () => {
* @return {this} * @return {this}
*/ */
clear() { clear() {
console.log('Before', em.get('DomComponents').getWrapper().getStyle());
em && em.get('DomComponents').getWrapper().setStyle('');
this.getAll().reset(); this.getAll().reset();
console.log('After', em.get('DomComponents').getWrapper().getStyle()); em && em.get('DomComponents').getWrapper().setStyle('');
return this; return this;
}, },

8
src/css_composer/view/CssRulesView.js

@ -4,8 +4,10 @@ var CssRuleView = require('./CssRuleView');
module.exports = Backbone.View.extend({ module.exports = Backbone.View.extend({
initialize(o) { initialize(o) {
this.config = o.config || {}; const config = o.config || {};
this.pfx = this.config.stylePrefix || ''; this.config = config;
this.em = config.em;
this.pfx = config.stylePrefix || '';
this.className = this.pfx + 'rules'; this.className = this.pfx + 'rules';
const coll = this.collection; const coll = this.collection;
this.listenTo(coll, 'add', this.addTo ); this.listenTo(coll, 'add', this.addTo );
@ -51,7 +53,7 @@ module.exports = Backbone.View.extend({
const frag = document.createDocumentFragment(); const frag = document.createDocumentFragment();
$el.empty(); $el.empty();
this.collection.each(model => this.addToCollection(model, frag)); this.collection.each(model => this.addToCollection(model, frag));
$el.append(fragment); $el.append(frag);
$el.attr('class', this.className); $el.attr('class', this.className);
return this; return this;
} }

Loading…
Cancel
Save