{ "id": "153468", "key": "ALOY-1335", "fields": { "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false }, "project": { "id": "11113", "key": "ALOY", "name": "Alloy", "projectCategory": { "id": "10400", "description": "Tools for developing applications", "name": "Tooling" } }, "fixVersions": [ { "id": "17081", "name": "Release 5.2.0", "archived": false, "released": true, "releaseDate": "2016-02-23" }, { "id": "17537", "name": "alloy 1.7.29", "archived": false, "released": true, "releaseDate": "2015-11-30" } ], "resolution": { "id": "1", "description": "A fix for this issue is checked into the tree and tested.", "name": "Fixed" }, "resolutiondate": "2015-11-30T20:50:07.000+0000", "created": "2015-11-27T10:41:20.000+0000", "priority": { "name": "Critical", "id": "1" }, "labels": [ "Alloy", "inheritance", "styles" ], "versions": [ { "id": "17533", "name": "alloy 1.7.28", "archived": false, "released": true, "releaseDate": "2015-11-25" } ], "issuelinks": [], "assignee": { "name": "fmiao", "key": "fmiao", "displayName": "Feon Sua Xin Miao", "active": true, "timeZone": "America/Vancouver" }, "updated": "2016-01-20T23:18:33.000+0000", "status": { "description": "The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.", "name": "Closed", "id": "6", "statusCategory": { "id": 3, "key": "done", "colorName": "green", "name": "Done" } }, "components": [ { "id": "13603", "name": "Styling", "description": "TSS, dynamic styling, styling API" } ], "description": "Alloy selectors provide ways to overload style rules based on switches (formFactor, OS, conditional rules, etc.). Say the TSS is somehow:\r\n\r\n{code}\r\n...\r\n\".title-home\": {\r\n\tbottom: 4,\r\n},\r\n\".title-home[formFactor=tablet]\": {\r\n\tbottom: 8\r\n},\r\n...\r\n{code}\r\n\r\nThe generated code will look like:\r\n\r\n{code}\r\nAlloy.deepExtend(true, o, {\r\n bottom: 4\r\n});\r\nAlloy.isTablet && _.extend(o, {\r\n bottom: 8\r\n});\r\n{code}\r\n\r\nIf this works fine with most of the properties, this is particularly annoying with font or nested properties. For instance, \r\n\r\n{code}\r\n\".title-home\": {\r\n\tfont: {\r\n\t\tfontFamily: \"Delius-Regular\",\r\n\t\tfontSize: 11\r\n\t}\r\n},\r\n\".title-home[formFactor=tablet]\": {\r\n\tfont: {\r\n\t\tfontSize: 22\r\n\t}\r\n},\r\n{code}\r\n\r\nwill result in the font name being simply ignored on tablets, as {{_.extend()}} is not a deepExtend method. We're lucky, Alloy provides a {{deepExtend()}} implementation which we may want to use. I therefore propose to switch from {{_.extend()}} to Alloy's {{deepExtend}} implementation. This will allow much more efficient ways of integrating complex graphical interfaces, with style inheritances all across the app:\r\n\r\n{code:xml}\r\n