{ "id": "115878", "key": "ALOY-706", "fields": { "issuetype": { "id": "2", "description": "A new feature of the product, which has yet to be developed.", "name": "New Feature", "subtask": false }, "project": { "id": "11113", "key": "ALOY", "name": "Alloy", "projectCategory": { "id": "10400", "description": "Tools for developing applications", "name": "Tooling" } }, "fixVersions": [ { "id": "15402", "description": "Alloy 1.2.0, concurrent with SDK 3.1.0", "name": "Alloy 1.2.0", "archived": false, "released": true, "releaseDate": "2013-08-15" }, { "id": "15489", "description": "2013 Sprint 12", "name": "2013 Sprint 12", "archived": true, "released": true, "releaseDate": "2013-06-17" }, { "id": "15887", "description": "2014 Sprint 03", "name": "2014 Sprint 03", "archived": true, "released": true, "releaseDate": "2014-02-14" } ], "resolution": { "id": "1", "description": "A fix for this issue is checked into the tree and tested.", "name": "Fixed" }, "resolutiondate": "2014-02-04T19:45:49.000+0000", "created": "2013-06-13T15:13:09.000+0000", "priority": { "name": "High", "id": "2" }, "labels": [ "qe-testadded" ], "versions": [], "issuelinks": [ { "id": "29584", "type": { "id": "10020", "name": "Depends", "inward": "is dependent of", "outward": "depends on" }, "outwardIssue": { "id": "115913", "key": "ALOY-709", "fields": { "summary": "Add ability to disable auto adding \"classes\" and \"apiName\" properties", "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" } }, "priority": { "name": "High", "id": "2" }, "issuetype": { "id": "4", "description": "An improvement or enhancement to an existing feature or task.", "name": "Improvement", "subtask": false } } } }, { "id": "29605", "type": { "id": "10020", "name": "Depends", "inward": "is dependent of", "outward": "depends on" }, "inwardIssue": { "id": "112534", "key": "ALOY-613", "fields": { "summary": "Develop API for adding/removing style classes", "status": { "description": "A resolution has been taken, and it is awaiting verification by reporter. From here issues are either reopened, or are closed.", "name": "Resolved", "id": "5", "statusCategory": { "id": 3, "key": "done", "colorName": "green", "name": "Done" } }, "priority": { "name": "High", "id": "2" }, "issuetype": { "id": "5", "description": "The sub-task of the issue", "name": "Sub-task", "subtask": true } } } }, { "id": "29539", "type": { "id": "10003", "name": "Relates", "inward": "relates to", "outward": "relates to" }, "outwardIssue": { "id": "109043", "key": "TIMOB-12553", "fields": { "summary": "TiAPI: Implement \"apiName\" property on proxies", "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" } }, "priority": { "name": "High", "id": "2" }, "issuetype": { "id": "2", "description": "A new feature of the product, which has yet to be developed.", "name": "New Feature", "subtask": false } } } } ], "assignee": null, "updated": "2018-03-07T22:25:39.000+0000", "status": { "description": "A resolution has been taken, and it is awaiting verification by reporter. From here issues are either reopened, or are closed.", "name": "Resolved", "id": "5", "statusCategory": { "id": 3, "key": "done", "colorName": "green", "name": "Done" } }, "components": [ { "id": "12329", "name": "Runtime", "description": "Generic bucket for uncategorized runtime issues" }, { "id": "13603", "name": "Styling", "description": "TSS, dynamic styling, styling API" } ], "description": "h2. main issue\r\n\r\nCurrently classes assigned to Titanium proxy objects created with XML elements and/or *Alloy.UI.create()* do not store the classes on the proxy object itself. They are used only to generate the style and then are forgotten. To this point this is because any additional assignments to a proxy object can be considered unnecessary overhead. In an effort to make dynamic styling (ALOY-210), and specifically class manipulation (ALOY-613) more intuitive, we should store the classes in an efficient manner so they can be used on subsequent style operations.\r\n\r\nTo do this, we should add a *classes* and *apiName* property to Ti proxies when they are created via markup or *Alloy.UI.create()*. If there are proxies created by other means, classes can be added as an array or string to be used by further style operations. Here's a few examples:\r\n\r\n{code}\r\nvar proxy;\r\n\r\nproxy = $.UI.create('Ti.UI.Button', {\r\n classes: ['dark','blue']\r\n});\r\nTi.API.info(proxy.classes);\r\nTi.API.info(proxy.apiName);\r\n// OUTPUT: ['dark','blue']\r\n// OUTPUT: 'Ti.UI.Button'\r\n\r\nproxy = $.UI.create('Ti.UI.Label', {\r\n classes: 'dark blue'\r\n});\r\nTi.API.info(proxy.classes);\r\nTi.API.info(proxy.apiName);\r\n// OUTPUT: ['dark','blue']\r\n// OUTPUT: 'Ti.UI.Label'\r\n\r\n\r\nTi.API.info($.yoyo.classes);\r\nTi.API.info($.yoyo.apiName);\r\n// OUTPUT: ['images','somethingElse']\r\n// OUTPUT: 'Ti.UI.ImageView'\r\n{code}\r\n\r\nh2. additional considerations\r\n\r\nWe need to make sure that this does not cause any excessive overhead on the creation of Titanium proxies with Alloy. A little overhead is acceptable and expected when actually manipulating styles at runtime, but the initial creation of the proxy should remain largely unaffected. We will need to verify proxy creation performance as part of this ticket.\r\n\r\nWe also need to make sure that all platforms are aware of *classes* and *apiName* being used for this purpose on proxies. We also need to make sure documentation is created in the API docs to show this property.\r\n\r\nh2. crude performance tester\r\n\r\nh4. index.xml\r\n{code:xml}\r\n\r\n\t\r\n\t\t\r\n\t\r\n\r\n{code}\r\n\r\nh4. index.js\r\n{code:javascript}\r\n$.index.open();\r\n\r\nfunction test() {\r\n\tvar total = 0;\r\n\tvar start, thisOne;\r\n\r\n\tfor (var j = 0; j < 10; j++) {\r\n\t\tstart = new Date().getTime();\r\n\t\tfor (var i = 0; i < 10000; i++) { // only used 100 on android\r\n\t\t\tAlloy.createController('test');\r\n\t\t}\r\n\t\tthisOne = (new Date().getTime()) - start;\r\n\t\ttotal += thisOne;\r\n\t\tTi.API.info('test #' + (j+1) + ': ' + thisOne);\r\n\t}\r\n\r\n\tTi.API.info('average: ' + (total/10));\r\n}\r\n{code}\r\n\r\nh4. test.xml\r\n{code:xml}\r\n\r\n\t\r\n\t\r\n\t\r\n\t\r\n\t\r\n\t\r\n\t\r\n\t\r\n\t\r\n\t\r\n\r\n{code}", "attachment": [], "flagged": false, "summary": "Store \"classes\" and \"apiName\" on Alloy-created proxies", "creator": { "name": "tlukasavage", "key": "tlukasavage", "displayName": "Tony Lukasavage", "active": true, "timeZone": "America/Los_Angeles" }, "subtasks": [], "reporter": { "name": "tlukasavage", "key": "tlukasavage", "displayName": "Tony Lukasavage", "active": true, "timeZone": "America/Los_Angeles" }, "environment": null, "comment": { "comments": [ { "id": "258009", "author": { "name": "tlukasavage", "key": "tlukasavage", "displayName": "Tony Lukasavage", "active": true, "timeZone": "America/Los_Angeles" }, "body": "PR: https://github.com/appcelerator/alloy/pull/157\r\ntest app: https://github.com/appcelerator/alloy/tree/master/test/apps/testing/ALOY-706\r\n\r\nFunctional test can pass if the app is run on all supported platforms and all runtime unit tests pass. ", "updateAuthor": { "name": "tlukasavage", "key": "tlukasavage", "displayName": "Tony Lukasavage", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2013-06-14T21:54:29.000+0000", "updated": "2013-06-14T21:54:29.000+0000" }, { "id": "264010", "author": { "name": "fcasali", "key": "fcasali", "displayName": "Federico Casali", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Functional and unit tests passed on iOS, Android and MobileWeb platforms.\n\nTitanium SDK 3.1.2.v20130726192706\nAlloy 1.2.0-alpha\nAppcelerator Studio 3.1.3.201307252418\nCLI 3.1.2\nNode 0.8.22\n\nClosing.", "updateAuthor": { "name": "fcasali", "key": "fcasali", "displayName": "Federico Casali", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2013-07-30T20:43:52.000+0000", "updated": "2013-07-30T20:43:52.000+0000" }, { "id": "291178", "author": { "name": "tlukasavage", "key": "tlukasavage", "displayName": "Tony Lukasavage", "active": true, "timeZone": "America/Los_Angeles" }, "body": "PR: https://github.com/appcelerator/alloy/pull/322\r\n\r\ntest should pass all runtime tests now", "updateAuthor": { "name": "tlukasavage", "key": "tlukasavage", "displayName": "Tony Lukasavage", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2014-02-04T19:45:49.000+0000", "updated": "2014-02-04T19:45:49.000+0000" } ], "maxResults": 4, "total": 4, "startAt": 0 } } }