{ "id": "114189", "key": "TIMOB-13816", "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": [], "resolution": { "id": "2", "description": "The problem described is an issue which will never be fixed.", "name": "Won't Fix" }, "resolutiondate": "2017-06-26T18:42:53.000+0000", "created": "2013-05-10T15:31:13.000+0000", "priority": { "name": "Low", "id": "4" }, "labels": [], "versions": [ { "id": "14162", "description": "Release 3.1.0", "name": "Release 3.1.0", "archived": true, "released": true, "releaseDate": "2013-04-16" }, { "id": "14982", "description": "Release 3.2.0", "name": "Release 3.2.0", "archived": false, "released": true, "releaseDate": "2013-12-19" } ], "issuelinks": [], "assignee": { "name": "cbarber", "key": "cbarber", "displayName": "Chris Barber", "active": true, "timeZone": "America/Chicago" }, "updated": "2018-04-04T23:20:31.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": "11500", "name": "MobileWeb", "description": "Mobile Web (HTML) Platform" } ], "description": "h2. problem \r\n\r\nWhen adding a \"click\" event to a Ti.UI.Button in Mobileweb, the event object's \"source\" property is not the Ti.UI.Button that a developer would expect. Instead a Ti.UI.View seems to be returned that does not actually represent the button. My first thought was that it had something to do with event bubbling, but only one occurrence of the event is fired and it only returns this somewhat bogus object. Just to be sure I set e.cancelBubble to true and I still encounter the same issue.\r\n\r\nThe use of e.source for identification is fairly common when multiple UI components will be referencing the same callback function. Android and iOS behave as expected, returning the Ti.UI.Button as the {{e.source}}.\r\n\r\nh2. test case\r\n\r\nThe issue surfaced in one of the Alloy test apps, but I've reduced it to a minimal, traditional Titanium test case.\r\n\r\n{code:javascript}\r\nvar win = Ti.UI.createWindow({\r\n\tbackgroundColor: '#fff'\t\r\n});\r\nvar button = Ti.UI.createButton({\r\n\ttitle: 'press me'\t\r\n});\r\n\r\nbutton.addEventListener('click', function(e) {\r\n\talert('source: ' + e.source.title + '\\nobject: ' + e.source.toString());\r\n});\r\n\r\nwin.add(button);\r\nwin.open();\r\n{code}\r\n\r\nEssentially, I would expect that the output of clicking the button would be:\r\n\r\n{code}\r\nsource: 'press me'\r\nobject: [object TiUIButton]\r\n{code}\r\n\r\nwhere I could then make decisions in my callback based on the title property of the button. Instead, it returns this which is not in line with the other platforms:\r\n\r\n{code}\r\nsource: undefined\r\nobject: [object TiUIView]\r\n{code}\r\n\r\nAlso I am not relying solely on the text output. I've tested the returned object and it is not a Button that happens to be returning the wrong information.\r\n\r\nh2. expected\r\n\r\n{{e.source}} in the above test case should return a reference to the Ti.UI.Button that was clicked.", "attachment": [], "flagged": false, "summary": "Mobileweb: e.source returning incorrect object when clicking a button", "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": "TiSDK 3.2.0.v20130412191647\r\nAndroid Emulator Browser (2.3.3 Google APIs HVGA)\r\nChrome 26.0.1410.65", "comment": { "comments": [ { "id": "422774", "author": { "name": "lmorris", "key": "lmorris", "displayName": "Lee Morris", "active": false, "timeZone": "America/Los_Angeles" }, "body": "Marking ticket as \"Won't Fix\" as MobileWeb has been deprecated.", "updateAuthor": { "name": "lmorris", "key": "lmorris", "displayName": "Lee Morris", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2017-06-26T18:42:53.000+0000", "updated": "2017-06-26T18:42:53.000+0000" }, { "id": "436404", "author": { "name": "emerriman", "key": "emerriman", "displayName": "Eric Merriman ", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Closing as will not fix.", "updateAuthor": { "name": "emerriman", "key": "emerriman", "displayName": "Eric Merriman ", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2018-04-04T23:20:31.000+0000", "updated": "2018-04-04T23:20:31.000+0000" } ], "maxResults": 3, "total": 3, "startAt": 0 } } }