Uploaded image for project: 'Alloy'
  1. Alloy
  2. ALOY-851

Alloy: Setting default ID on first top-level XML view element doesn't take platform attribute into account

    Details

      Description

      The compiler sets the id of the first top-level XML view element to the default (the controller name) before the platform conditions are evaluated. Now if you have a view in which you use the platform attribute to select which top-level element should be used for each platform, this leads to unpredictable behavior. Only the first (conditional) top-level element will get the default id.

      Steps to reproduce

      1. Create new project: titanium create -p ios,android -n defaultid --id ti.defaultid -d .
      2. Initialize Alloy: cd defaultid && alloy new
      3. Replace contents of index.xml with:

          <Alloy>
              <Window platform="ios" class="container">
                  <Label id="label" onClick="doClick">Hello, World</Label>
              </Window>
              <Window platform="android" class="container">
                  <Label id="label" onClick="doClick">Hello, World</Label>
              </Window>
          </Alloy>
          

      4. Compile for iOS: alloy compile -c platform=ios
      5. Open Resources/alloy/controllers/index.js and see that the window has correctly been given index as id.
      4. Compile for Android: alloy compile -c platform=android
      5. Open Resources/alloy/controllers/index.js and see that the window has not been given index as id.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                tlukasavage Tony Lukasavage
                Reporter:
                mpmiranda Mauro Parra-Miranda
              • Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Backbone Issue Sync

                  • Backbone Issue Sync is enabled for your project, but we do not have any synchronization info for this issue.

                    Git Integration