[ALOY-1355] Alloy doesn't cast "true"/"false" attributes as booleans

GitHub Issuen/a
Resolution Date2016-02-16T18:02:53.000+0000
Affected Version/sRelease 5.1.2
Fix Version/salloy 1.7.33, alloy 1.7.34
Labelsmobileweb, newline, suppressReturn, textarea
ReporterMax Navsii
AssigneeChris Barber


Textarea does not want to add a new line when I'm pressing return key (from my keyboard) when I run the application as a "Mobile Web Preview in Browser". However it works great when running in an Android Emulator. Steps to reproduce : 1) Create a new project (use the "Two-Tabbed Alloy Application" sample) 2) In the project, replace index.xml with the one in the attachment files. 3) Run the application as a Mobile Web Preview in Browser 4) Try to type in the textarea, and push return key from your keyboard 5) It will loose focus instead of adding a new line.




  1. Ritu Agrawal 2014-02-18 Moving this ticket to engineering as the provided sample works fine with iOS application but does not work with Mobile Web application (tried with Studio in-built browser as well as Safari).
  2. Dirlei DionĂ­sio 2016-02-05 I realize that the problem only happens with Alloy when I define [suppressReturn="false"] on the XML file. In this case, the generated .js file (in Resources folder) has a [suppressReturn: "false"] (with quotes) that is evaluated as true by the JavaScript interpreter. The same happens if I define [suppressReturn=false] (without quotes) on a xml. When I define [suppressReturn: false] on the .tss file, the generated .js file have a [suppressReturn: false] (without quotes) and all works as expected.
  3. Chris Barber 2016-02-12 PR: https://github.com/appcelerator/alloy/pull/756 This fix may cause other issues. Since Alloy doesn't know the data types of each attribute, it simply will have to check if the string value equals "true" or "false", then cast as a boolean. We should add a proper fix in a future Alloy release.
  4. Fokke Zandbergen 2016-02-16 [~cb1kenobi] alternatively, we could let Alloy use a fork of the xmldom package we use and only cast these types when no quotes are used, which sax.js handles here: https://github.com/jindw/xmldom/blob/master/sax.js#L270 https://github.com/jindw/xmldom/blob/master/sax.js#L298
  5. Chris Barber 2016-02-16 [~fokkezb] I don't want to use a fork of xmldom, especially since I'm going to be tackling the Alloy build soon.
  6. Fokke Zandbergen 2016-02-16 Fair enough :)

JSON Source