[ALOY-562] Order of TSS classes declaration has effect instead of order in which they are assigned to an object

GitHub Issuen/a
ResolutionWon't Fix
Resolution Date2013-03-13T13:21:14.000+0000
Affected Version/sn/a
Fix Version/sn/a
Labelsalloy, alloy-generate
ReporterDavide Cassenti
AssigneeTony Lukasavage


Changing the order of class declarations in TSS files actually changes the order in which the attribute values are applied. Changing the order of the classes in the element "class" attribute doesn't make any difference. This is different from what a user would normally expect (looking at CSS) and not logical. Refer to the testcase attached. The text displayed shows the exact class attribute value. One would expect the order of classes in the class attribute would affect the appearance. Instead, the order of classes declaration in the TSS file does.




  1. Davide Cassenti 2013-03-13 Quick test case. In index.xml we would have:
       	<Window class="container" layout="vertical">
       		<Label class="style1 style2" text="style1 style2"/>
       		<Label class="style2 style1" text="style2 style1"/>
    Both lines have style2 applied, because style2 is defined after style1 in index.tss
  2. Tony Lukasavage 2013-03-13 This behavior is by design and is consistent with CSS: http://stackoverflow.com/questions/1321692/how-to-specifiy-the-order-of-css-classes
  3. Andrey Chirikba 2013-03-13 I see I was mistaken about the CSS (it was and stays confusing). But why would someone want this in Alloy? It is much more logical to be able to specify the order of classes application in the element instead of by the order of definitions.
  4. Tony Lukasavage 2013-03-13 I disagree, as order in the style files is always significant in pretty much any framework. The developer generally places them there with specific intention. If you need more flexibility in the application of classes, you should likely use more, smaller classes that cover specific characteristics and have less overlap.

JSON Source