Titanium JIRA Archive
Alloy (ALOY)

[ALOY-790] Alloy: Error when calling $.createStyle if the style file contains

GitHub Issuen/a
TypeBug
PriorityHigh
StatusClosed
ResolutionDuplicate
Resolution Date2013-08-15T21:20:19.000+0000
Affected Version/sAlloy 1.2.1
Fix Version/s2013 Sprint 17
Componentsn/a
Labelsn/a
ReporterDaniel Sefton
AssigneeTony Lukasavage
Created2013-08-10T11:34:04.000+0000
Updated2014-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

Comments

  1. Daniel Sefton 2013-08-12

    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!
  2. Daniel Sefton 2013-08-15

    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.
  3. Tony Lukasavage 2013-08-15

    Duplicate of ALOY-789
  4. Tony Lukasavage 2013-08-15

    This is resolved in ALOY-789 and is already in the 1.2.1 release candidate. You can get it like this:
       [sudo] npm install -g alloy@1.2.1-cr
       
    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.
  5. Daniel Sefton 2013-08-15

    Confirmed fixed with 1.2.1-cr

JSON Source