Browse Source

Init component with classes from attributes. Fixes #2836

pull/2872/head
Artur Arseniev 6 years ago
parent
commit
d3a2e54eb3
  1. 3
      src/dom_components/model/Component.js

3
src/dom_components/model/Component.js

@ -552,8 +552,9 @@ const Component = Backbone.Model.extend(Styleable).extend(
initClasses() {
const event = 'change:classes';
const attrCls = this.get('attributes').class || [];
const toListen = [this, event, this.initClasses];
const cls = this.get('classes') || [];
const cls = this.get('classes') || attrCls;
const clsArr = isString(cls) ? cls.split(' ') : cls;
this.stopListening(...toListen);
const classes = this.normalizeClasses(clsArr);

Loading…
Cancel
Save