• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

Design issue Duplicate style properties

Arty

Well-known member
#1
If two similar styles that have same custom style properties are installed in different parts of styles tree (as in not child styles of each other) and then moved to same styles tree, style properties get duplicated.

How to test it:

Here is a blank style with 1 new style property:
Code:
<?xml version="1.0" encoding="utf-8"?>
<style title="Test Style" description="" user_selectable="1">
  <properties>
  <property property_name="testProperty" property_type="scalar" definition="1" group_name="general" title="Test property" description="" css_components="" scalar_type="boolean" scalar_parameters="" display_order="1" sub_group=""><![CDATA[1]]></property>
  </properties>
  <templates/>
</style>
It has a custom check box "Test property" that is shown in style properties -> general.

Install it twice, make sure they are not part of same styles tree:
tree_origina;.png

Then edit one of styles to set it as child style of another style:

changed_tree.png

Then look in style properties -> general, where custom style property is:
duplicate_properties.png

As you can see there are two identical style properties instead of one.

To make things more confusing, style property from parent style overrides style property from child style.
 

Mike

XenForo developer
Staff member
#2
I'm going to have to call this a design issue. Properties are expected (and assumed) to be unique in a tree. You can see this if you try to create a property with a duplicate name in a child style. Detecting this case when moving a style is difficult (and then there's a problem of how to actually handle the situation).

This is one of those where the alternative mostly involves not allowing style properties to be defined anywhere other than the master style and that is likely not a trade off stylers would be happy with.