{ "id": "63775", "key": "TIMOB-3143", "fields": { "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false }, "project": { "id": "10153", "key": "TIMOB", "name": "Titanium SDK/CLI", "projectCategory": { "id": "10100", "description": "Titanium and related SDKs used in application development", "name": "Client" } }, "fixVersions": [ { "id": "11244", "name": "Release 1.7.0", "archived": true, "released": true, "releaseDate": "2011-06-13" }, { "id": "11250", "name": "Sprint 2011-15", "archived": true, "released": true, "releaseDate": "2011-04-18" } ], "resolution": { "id": "1", "description": "A fix for this issue is checked into the tree and tested.", "name": "Fixed" }, "resolutiondate": "2011-05-16T11:03:13.000+0000", "created": "2011-04-15T03:37:58.000+0000", "priority": { "name": "Low", "id": "4" }, "labels": [ "defect", "ios", "klist", "release-1.7.0", "reported-1.6.0", "rplist" ], "versions": [ { "id": "11244", "name": "Release 1.7.0", "archived": true, "released": true, "releaseDate": "2011-06-13" } ], "issuelinks": [], "assignee": { "name": "jacobrelkin", "key": "jacobrelkin", "displayName": "Jacob Relkin", "active": true, "timeZone": "America/Los_Angeles" }, "updated": "2011-05-16T11:03:13.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": "10206", "name": "iOS", "description": "iOS Platform" } ], "description": "{html}
When using a jss the className does not take priority over the\nlabel name as it should.
\nExample:
app.js
\n\n\nTitanium.UI.setBackgroundColor('#000');\nvar win = Ti.UI.createWindow({\n backgroundColor: '#fff'\n});\nvar normalLabel = Ti.UI.createLabel({\n text: 'Normal label!',\n textAlign: 'center',\n width: 'auto',\n top: 50\n});\nvar redLabel = Ti.UI.createLabel({\n text: 'Red label!',\n textAlign: 'center',\n width: 'auto',\n top: 100,\n className: 'red'\n});\nwin.add(normalLabel);\nwin.add(redLabel);\nwin.open();
\n
\napp.jss
\n\n\nlabel{ \n color: 'blue'; \n} \n.red { \n font-weight: 'bold';\n color: 'red';\n}
\n
\nExpected: normalLabel to be blue and redLabel\nto be red
\nActual: both labels are blue
\nOkay, here goes:
\nWhen we compile the CSS into a plist, we create four\ndictionaries: \"ids\" and \"classes\", and corresponding dicts with\nthose names appended with \"density\".
\nThe compiler apparently merges tag selectors and\nclasses into the \"classes\" dictionary, while the ids are kept\nseparate as they should be.
\nSo, in our code, we're iterating over the classes first, then\nthe ids to maintain priority. Works great, right?\nNope.
\nSince we're iterating over the classes first, which are already\nmerged together with the tag selectors, we lose the precedence that\nthe classes have over the tag selectors.
\nAlso, an interesting test case is to try using a class name like\n\".label\" - this will act exactly as a tag selector would - apply\nthe style to all TiUILabels because of the aforementioned merging\nof the dictionaries!