[ALOY-1003] ListView binding compile error when "type" is used as a bindId
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | Medium |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2014-05-28T14:54:34.000+0000 |
Affected Version/s | n/a |
Fix Version/s | Alloy 1.5.0 |
Components | Styling |
Labels | n/a |
Reporter | Paul Mietz Egli |
Assignee | Feon Sua Xin Miao |
Created | 2014-05-01T18:29:18.000+0000 |
Updated | 2014-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
File | Date | Size |
---|---|---|
TestListApp.zip | 2014-05-17T13:01:45.000+0000 | 6005784 |
PR with test and fix sent: https://github.com/appcelerator/alloy/pull/382
PR passes all tests, changes appear to not affect use of Alloy only the compilation process, thus I've accepted and merged the PR.
PR accepted and merged
The fix turned out to have unintended consequences not obvious from the automated tests. Reopening to come up with a different solution.
Please run the attached test app to reproduce the error. index.xml
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.
PR merged
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|