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

Alloy: Default top-level ID doesn't take if-attribute into account

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Medium
    • Resolution: Fixed
    • Affects Version/s: alloy 1.7.16
    • Fix Version/s: Release 5.1.0, alloy 1.7.17
    • Component/s: XML
    • Labels:
      None
    • Environment:

      CLI 5.0.2
      Alloy 1.7.10

    • Story Points:
      5
    • Sprint:
      2015 Sprint 21 Tooling

      Description

      While ALOY-851 is said to be fixed, the following:

      <Alloy>
      	
      	<TabGroup if="Alloy.Globals.requiredVersion">
      		<Require src="list" />
      		<Require src="apis" />
      		<Require src="console" />
      	</TabGroup>
       
      	<Window if="!Alloy.Globals.requiredVersion">
      		<Label>This sample requires Titanium 5.1 or later</Label>
      	</Window>
       
      </Alloy>
      

      still compiles to:

          if (Alloy.Globals.requiredVersion) {
              var __alloyId11 = [];
              $.__views.__alloyId12 = Alloy.createController("list", {
                  id: "__alloyId12"
              });
              __alloyId11.push($.__views.__alloyId12.getViewEx({
                  recurse: true
              }));
              $.__views.__alloyId14 = Alloy.createController("apis", {
                  id: "__alloyId14"
              });
              __alloyId11.push($.__views.__alloyId14.getViewEx({
                  recurse: true
              }));
              $.__views.__alloyId16 = Alloy.createController("console", {
                  id: "__alloyId16"
              });
              __alloyId11.push($.__views.__alloyId16.getViewEx({
                  recurse: true
              }));
              $.__views.index = Ti.UI.createTabGroup({
                  tabsBackgroundColor: "white",
                  tabsTintColor: Alloy.CFG.brandPrimary,
                  tabs: __alloyId11,
                  id: "index"
              });
              $.__views.index && $.addTopLevelView($.__views.index);
          }
          if (!Alloy.Globals.requiredVersion) {
              $.__views.__alloyId17 = Ti.UI.createWindow({
                  backgroundColor: "#fff",
                  barColor: Alloy.CFG.brandPrimary,
                  navTintColor: "#FFF",
                  translucent: false,
                  titleAttributes: {
                      color: "#FFF"
                  },
                  id: "__alloyId17"
              });
              $.__views.__alloyId17 && $.addTopLevelView($.__views.__alloyId17);
              $.__views.__alloyId18 = Ti.UI.createLabel({
                  text: "This sample requires Titanium 5.1 or later",
                  id: "__alloyId18"
              });
              $.__views.__alloyId17.add($.__views.__alloyId18);
          }
      

      which shows that the negative condition does not give the ID "index" to the window, which it should.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                fmiao Feon Sua Xin Miao
                Reporter:
                fokkezb Fokke Zandbergen
                Reviewer:
                Fokke Zandbergen
              • 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