Browse Source

Add default attributes in the creation of new components

pull/1705/head
Artur Arseniev 8 years ago
parent
commit
44a9e00b76
  1. 5
      src/dom_components/model/Component.js

5
src/dom_components/model/Component.js

@ -170,7 +170,10 @@ const Component = Backbone.Model.extend(Styleable).extend(
this.em = em; this.em = em;
this.config = opt.config || {}; this.config = opt.config || {};
this.ccid = Component.createId(this); this.ccid = Component.createId(this);
this.set('attributes', this.get('attributes') || {}); this.set('attributes', {
...(this.defaults.attributes || {}),
...(this.get('attributes') || {})
});
this.initClasses(); this.initClasses();
this.initTraits(); this.initTraits();
this.initComponents(); this.initComponents();

Loading…
Cancel
Save