From a6564878f0619b445d434daeee8a6163152d9687 Mon Sep 17 00:00:00 2001 From: Artur Arseniev Date: Tue, 19 Jun 2018 08:03:12 +0200 Subject: [PATCH] Update getAttributes in Component --- 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 760f579d1..e1259c5f2 100644 --- a/src/dom_components/model/Component.js +++ b/src/dom_components/model/Component.js @@ -364,15 +364,18 @@ const Component = Backbone.Model.extend(Styleable).extend( * @return {Object} */ getAttributes() { + const { em } = this; const classes = []; const attributes = { ...this.get('attributes') }; + const sm = em && em.get('SelectorManager'); + const id = this.getId(); // Add classes this.get('classes').each(cls => classes.push(cls.get('name'))); classes.length && (attributes.class = classes.join(' ')); // If the rule is setted we need an ID attached to the component - if (!has(attributes, 'id') && this.rule) { + if (!has(attributes, 'id') && sm.get(id, sm.Selector.TYPE_ID)) { attributes.id = this.getId(); }