From 44a9e00b76835ab4d952842461ac08d7a00c26dd Mon Sep 17 00:00:00 2001 From: Artur Arseniev Date: Sun, 23 Dec 2018 13:54:01 +0100 Subject: [PATCH] Add default attributes in the creation of new components --- src/dom_components/model/Component.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/dom_components/model/Component.js b/src/dom_components/model/Component.js index 39bd3c8a0..8d4036126 100644 --- a/src/dom_components/model/Component.js +++ b/src/dom_components/model/Component.js @@ -170,7 +170,10 @@ const Component = Backbone.Model.extend(Styleable).extend( this.em = em; this.config = opt.config || {}; this.ccid = Component.createId(this); - this.set('attributes', this.get('attributes') || {}); + this.set('attributes', { + ...(this.defaults.attributes || {}), + ...(this.get('attributes') || {}) + }); this.initClasses(); this.initTraits(); this.initComponents();