Titanium JIRA Archive
Alloy (ALOY)

[ALOY-1003] ListView binding compile error when "type" is used as a bindId

GitHub Issuen/a
TypeBug
PriorityMedium
StatusClosed
ResolutionFixed
Resolution Date2014-05-28T14:54:34.000+0000
Affected Version/sn/a
Fix Version/sAlloy 1.5.0
ComponentsStyling
Labelsn/a
ReporterPaul Mietz Egli
AssigneeFeon Sua Xin Miao
Created2014-05-01T18:29:18.000+0000
Updated2014-09-15T09:32:26.000+0000

Description

I was running into the following compiler error when building my project with 1.4.0-dev:
[DEBUG] [ERROR] : Object #<Object> has no method 'indexOf'
[DEBUG] [ERROR] Alloy compiler failed
I eventually traced this down to the use of the string "type" as my bindId in my ListItem template. The parse() method in default.js adds a property named "type" to view templates, which appears to be overwritten by my bindId value of "type", which causes processStyle() in styler.js to fail at line 359. I changed "type" to "__type" in both default.js and styler.js, which appears to have fixed the issue. Test case attached with commented-out working code in index.xml

Attachments

FileDateSize
TestListApp.zip2014-05-17T13:01:45.000+00006005784

Comments

  1. Paul Mietz Egli 2014-05-01

    PR with test and fix sent: https://github.com/appcelerator/alloy/pull/382
  2. Tim Poulsen 2014-05-02

    PR passes all tests, changes appear to not affect use of Alloy only the compilation process, thus I've accepted and merged the PR.
  3. Tim Poulsen 2014-05-02

    PR accepted and merged
  4. Tim Poulsen 2014-05-02

    The fix turned out to have unintended consequences not obvious from the automated tests. Reopening to come up with a different solution.
  5. Feon Sua Xin Miao 2014-05-17

    Please run the attached test app to reproduce the error. index.xml
       <!-- this doesn't compile -->
       <ListItem template="template" type:text="hola"/>
       
       <!-- this compiles -->
       <ListItem template="template" />
       
  6. Feon Sua Xin Miao 2014-05-26

    PR: https://github.com/appcelerator/alloy/pull/417 Test app: https://github.com/feons/alloy/tree/ALOY-1003/test/apps/testing/ALOY-1003 Functional Test: 1. Test app uses "type" as the listview template bindid, it compiles with no error. 2. Date time picker in the test app is parsed and loads fine.
  7. Tim Poulsen 2014-05-28

    PR merged
  8. Kajenthiran Velummaylum 2014-09-15

    Closing the ticket as it's working with attached sample project. | Appcelerator Studio | 3.4.0.201409131030 | | Titanium SDK | 3.4.0.v20140913174915| | Alloy | 1.5.0-rc2| | CLI | 3.4.0-rc3 | | OS | OSX 10.9.4 | | Xcode | Xcode6-GM | | Device | iPhone5S(iOS 8.0) Simulator, Galaxy S5 (v4.4.2) device|

JSON Source