Browse Source

Update getAttributes in Component

pull/1229/head
Artur Arseniev 8 years ago
parent
commit
a6564878f0
  1. 5
      src/dom_components/model/Component.js

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

Loading…
Cancel
Save