Titanium JIRA Archive
Alloy (ALOY)

[ALOY-665] Using namespace in markup event

GitHub Issuen/a
TypeBug
PriorityMedium
StatusClosed
ResolutionFixed
Resolution Date2013-06-20T02:59:40.000+0000
Affected Version/sAlloy 1.1.3
Fix Version/sAlloy 1.2.0, 2013 Sprint 13
ComponentsRuntime, XML
Labelsalloy, qe-testadded
ReporterNavid Ghahramani
AssigneeTony Lukasavage
Created2013-05-22T03:00:30.000+0000
Updated2013-07-15T22:32:30.000+0000

Description

Hi, I got this error when I use namespace in markup event. For example: Home.xml
<Button id="orderButton" onClick="Home.onOrderClick"></Button>
Home.js
var Home = {}
 
Home.onOrderClick = function() {
 
}
I got this error: undefined' is not an object (evaluating 'Home.onOrderClick') then I opened compiled Home.js and I saw this:
Home.onOrderClick ? $.__views.orderButton.addEventListener("click", Home.onOrderClick) : __defers["$.__views.orderButton!click!onOrderClick"] = true;
I think you can fixed it with this code
Home != null && Home.onOrderClick ? $.__views.orderButton.addEventListener("click", Home.onOrderClick) : __defers["$.__views.orderButton!click!onOrderClick"] = true;
Thanks

Comments

  1. Tony Lukasavage 2013-06-20

    PR: https://github.com/appcelerator/alloy/pull/159 test app: https://github.com/appcelerator/alloy/tree/master/test/apps/testing/ALOY-665 Functional testing can be passed by successfully running the app on all supported platforms. The fact that the app runs without a runtime error on initial load indicates that the bug is fixed. You can additionally test by generating touchstart, touchend, and swipe events. Confirming that all 3 events pop up in the console log will further attest to its improvement, but this is not entirely necessary as I don't want any possible platform disparities to be interpreted as issues directly related to this ticket.
  2. Federico Casali 2013-07-15

    Verified as fixed. Environment: Titanium SDK 3.1.2.v20130710144553 Appcelerator Studio 3.1.2.201307101037 Alloy 1.2.0 Android 4.2.2 and iOS 5 Closing.

JSON Source