Titanium JIRA Archive
Appcelerator Community (AC)

[AC-2922] Titanium Trims Too Much White-space from HTML

GitHub Issuen/a
TypeBug
Priorityn/a
StatusClosed
ResolutionDuplicate
Resolution Date2013-12-19T04:56:02.000+0000
Affected Version/sn/a
Fix Version/sn/a
Componentsn/a
Labelsn/a
ReporterJoel Koett
AssigneeRitu Agrawal
Created2012-07-06T11:06:12.000+0000
Updated2016-03-08T07:47:54.000+0000

Description

I upgraded Titanium yesterday to this version: {panel} Titanium Studio, build: 2.1.0.201206251749 (c) Copyright 2012 by Appcelerator, Inc. All rights reserved. Build: jenkins-titanium-rcp-master-218 (origin/master) Date: 25 June 2012, 17:50:34 {panel} And this is the aptana version: {panel} Aptana 3.2.0.20120625, featureid org.radrails.rails {panel} It seems to have introduced a bug that trims white-space from the html in places where it should not. For example:
Joel Koett
gets trimmed to
JoelKoett
, leaving the results in the view as "JoelKoett" rather than "Joel Koett". Another example would be in some jsrender scripts I have, which trims: {panel}
blah
{panel} to {panel}
blah
{panel} Which, after rendered, leaves the class as "buttonon" rather than what it should be left as, which is "button on". Note: This only happens in the compiled code, not in the iphone simulator. Thanks for your help :), -- Joel.

Comments

  1. Joel Koett 2012-07-06

    I believe this is related to: APSTUD-1958
  2. Joel Koett 2012-07-07

    After a day of debugging, it turns out that the issue was not caused by my upgrade to Titanium 2.1 - the issue also happens in Titanium 2.0.1. The white-space trimmer only happens if I have no files with extension "js". Due to another issue (TC-1042), I was forced to rename all of my javascript files, but I missed one. Having this one js file prevented the white-space trimmer from happening. Last week, just before my upgrade to Titanium 2.1, I realized that the last remaining js file in my web folder in my Titanium project, was unused, and so I deleted it. This caused the Titanium white-space trimmer to take effect (ONLY ON COMPILED VERSIONS OF THE APP). To fix this bug, I just include a dummy "js" file in my project. It's not even referenced anywhere, but it prevents this bug from occurring. It should be noted: The compiler is "smart" enough to "figure out" that some js files aren't used, and so it doesn't include them in the build (hence ticket TC-1042), but the same compiler uses the fact that there is a JS file (even if it will be stripped via the process in TC-1042 because it's un-referenced) to avoid doing this poorly written white-space trimmer. And on a final note, I think this white-space trimmer also causes issue TC-1043, my guess is that it trims the white space between the comment line and the closing function, turning: {panel}
       function doSomething() {
          // comment
       }
       
    {panel} into: {panel}
         function doSomething() { // comment }
       
    {panel} (which is invalid javascript, since the closing curly-brace is commented out) Thanks for your help, -- Joel.
  3. Davide Cassenti 2012-07-17

    Hello, Can you please provide a code sample? I did not get why you are renaming the javascript files, and how exactly the app should work. Thank you
  4. Davide Cassenti 2012-07-23

    Hello, Any additional information on this issue? Thank you
  5. Ritu Agrawal 2013-12-19

    Duplicate of APSTUD-1958. APSTUD-1958 has been resolved for sometime now so please let us know if this issue continues to persist and we would be happy to reopen this issue.

JSON Source