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(); }