Browse Source

Fix incorrect target for requiresParent

pull/1710/head
David Polak 8 years ago
parent
commit
5862b9bd0f
  1. 12
      src/style_manager/view/PropertyView.js

12
src/style_manager/view/PropertyView.js

@ -419,6 +419,7 @@ module.exports = Backbone.View.extend({
const requires = model.get('requires'); const requires = model.get('requires');
const requiresParent = model.get('requiresParent'); const requiresParent = model.get('requiresParent');
const sectors = this.sector ? this.sector.collection : null; const sectors = this.sector ? this.sector.collection : null;
const selected = this.em ? this.em.getSelected() : null;
let stylable = trg.get('stylable'); let stylable = trg.get('stylable');
// Stylable could also be an array indicating with which property // Stylable could also be an array indicating with which property
@ -456,12 +457,13 @@ module.exports = Backbone.View.extend({
// Check if the property is available based on parent's property values // Check if the property is available based on parent's property values
if (requiresParent) { if (requiresParent) {
if ( if (
trg.view && selected &&
trg.view.$el && selected.view &&
trg.view.$el[0] && selected.view.$el &&
trg.view.$el[0].parentNode selected.view.$el[0] &&
selected.view.$el[0].parentNode
) { ) {
const styles = window.getComputedStyle(trg.view.$el[0].parentNode); const styles = window.getComputedStyle(selected.view.$el[0].parentNode);
each(requiresParent, (values, property) => { each(requiresParent, (values, property) => {
stylable = stylable =
stylable && styles[property] && includes(values, styles[property]); stylable && styles[property] && includes(values, styles[property]);

Loading…
Cancel
Save