[ALOY-790] Alloy: Error when calling $.createStyle if the style file contains
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | High |
Status | Closed |
Resolution | Duplicate |
Resolution Date | 2013-08-15T21:20:19.000+0000 |
Affected Version/s | Alloy 1.2.1 |
Fix Version/s | 2013 Sprint 17 |
Components | n/a |
Labels | n/a |
Reporter | Daniel Sefton |
Assignee | Tony Lukasavage |
Created | 2013-08-10T11:34:04.000+0000 |
Updated | 2014-06-22T13:21:00.000+0000 |
Description
*Problem*
The \n will be replaced in /alloy/styles/thecontroller.js with a new line causing an error when the file is required ($.createStyle called for example). A test case for iOS is included below.
*index.xml*
<Alloy>
<Window class="container">
<Label id="label" onClick="doClick"/>
</Window>
</Alloy>
*index.tss*
".container": {
backgroundColor:"white"
},
"Label": {
width: Ti.UI.SIZE,
height: Ti.UI.SIZE,
color: "#000",
text:'Hello\nworld'
}
*index.js*
function doClick(e) {
alert($.label.text);
}
$.index.open();
$.createStyle({
classes:['test']
});
*Error (iOS)*
[ERROR] : Script Error {
[ERROR] : line = 1;
[ERROR] : message = "Parse error";
[ERROR] : name = SyntaxError;
[ERROR] : sourceId = 284051488;
[ERROR] : sourceURL = "file://localhost/Users/hani/Library/Application%20Support/iPhone%20Simulator/6.1/Applications/BA328F3A-899A-4681-9A30-55085E4A2AA9/BugTest.app/alloy/styles/index.js";
[ERROR] : }
[ERROR] : Script Error Module "alloy/styles/index" failed to leave a valid exports object
*Error (Android)*
08-15 14:08:06.745: E/TiExceptionHandler(8933): (main) [0,610] - Message: Uncaught SyntaxError: Unexpected token ILLEGAL
08-15 14:08:06.810: E/V8Exception(8933): Exception occurred at alloy/styles/index.js:1: Uncaught SyntaxError: Unexpected token ILLEGAL
Hi Hani, Please can you provide a simple reproducible test case for this? Be sure to include all code necessary for us to create a runnable project. Thanks!
Tested and confirmed on iOS 6 simulator and Samsung Galaxy S2 2.3.6 with Ti SDK 3.1.1 GA and Alloy 1.2.1.
Duplicate of ALOY-789
This is resolved in ALOY-789 and is already in the 1.2.1 release candidate. You can get it like this:
The official 1.2.1 will be released early next week. If you guys would be so kind as to confirm that using 1.2.1-cr fixes the issue, that would be great.
Confirmed fixed with 1.2.1-cr