{ "id": "111043", "key": "ALOY-552", "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": "15271", "description": "Alloy 1.1.0, concurrent with SDK 3.1.0", "name": "Alloy 1.1.0", "archived": false, "released": true, "releaseDate": "2013-04-16" }, { "id": "14875", "description": "2013 Sprint 06", "name": "2013 Sprint 06", "archived": true, "released": true, "releaseDate": "2013-03-25" } ], "resolution": { "id": "1", "description": "A fix for this issue is checked into the tree and tested.", "name": "Fixed" }, "resolutiondate": "2013-03-18T19:27:39.000+0000", "created": "2013-03-12T11:28:58.000+0000", "priority": { "name": "High", "id": "2" }, "labels": [ "alloy", "alloy-generate", "qe-port" ], "versions": [], "issuelinks": [], "assignee": { "name": "tlukasavage", "key": "tlukasavage", "displayName": "Tony Lukasavage", "active": true, "timeZone": "America/Los_Angeles" }, "updated": "2013-05-01T14:56:29.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": "12329", "name": "Runtime", "description": "Generic bucket for uncategorized runtime issues" }, { "id": "12326", "name": "XML", "description": "View XML and parsing" } ], "description": "When using XML markup to set an event listener on an element inside a repetition view, Alloy generates erroneous code. The auto-generated object ids are not counted correctly, which leads to using one id to create an object and another id to try and set an event listener on it. Consider this snippet:\r\n\r\n\r\n\t\r\n\r\nIt is translated to the below:\r\n\r\n var __alloyId8 = function(e) {\r\n var models = Alloy.Collections.document.models, children = $.__views.__alloyId4.children;\r\n for (var d = children.length - 1; d >= 0; d--) $.__views.__alloyId4.remove(children[d]);\r\n len = models.length;\r\n for (var i = 0; i < len; i++) {\r\n var __alloyId5 = models[i];\r\n __alloyId5.__transform = {};\r\n var __alloyId7 = Ti.UI.createLabel({\r\n width: Ti.UI.SIZE,\r\n height: Ti.UI.SIZE,\r\n color: \"#000\",\r\n text: typeof __alloyId5.__transform.id != \"undefined\" ? __alloyId5.__transform.id : __alloyId5.get(\"id\"),\r\n id: \"__alloyId6\"\r\n });\r\n $.__views.__alloyId4.add(__alloyId7);\r\n idClicked ? $.__views.__alloyId6.addEventListener(\"click\", idClicked) : __defers[\"$.__views.__alloyId6!click!idClicked\"] = !0;\r\n }\r\n };\r\n\r\nNotice the __alloyId6 id is used to try and set the event listener instead of __alloyId7 that was actually defined.\r\n\r\nThis leads to a run-time crash. Please see a testcase attached.", "attachment": [ { "id": "36196", "filename": "RepeaterTestcase.zip", "author": { "name": "a.chirikba", "key": "a.chirikba", "displayName": "Andrey Chirikba", "active": true, "timeZone": "Europe/Berlin" }, "created": "2013-03-12T11:28:58.000+0000", "size": 38300, "mimeType": "application/zip" } ], "flagged": false, "summary": "Alloy generates erroneous code to set an event listener inside a repetition view", "creator": { "name": "a.chirikba", "key": "a.chirikba", "displayName": "Andrey Chirikba", "active": true, "timeZone": "Europe/Berlin" }, "subtasks": [], "reporter": { "name": "a.chirikba", "key": "a.chirikba", "displayName": "Andrey Chirikba", "active": true, "timeZone": "Europe/Berlin" }, "environment": "Any", "comment": { "comments": [ { "id": "246694", "author": { "name": "fcasali", "key": "fcasali", "displayName": "Federico Casali", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Verified as fixed.\n\nAlloy version 1.1.0-cr\nCLI version 3.1.0-cr\nAndroid and iOS\n\nClosing.", "updateAuthor": { "name": "fcasali", "key": "fcasali", "displayName": "Federico Casali", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2013-04-09T18:44:13.000+0000", "updated": "2013-04-09T18:44:13.000+0000" } ], "maxResults": 1, "total": 1, "startAt": 0 } } }