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

Using conditional TSS results in unexpected _.extend() calls

    Details

      Description

      I have a complex project where the I saw a lot of inefficient and unlogical _.extend() calls in the controller.

      I brought it down to this test case:

      1. Create a default Alloy project.
      2. Create a styles/app.tss.
      3. In both styles/index.tss and styles/app.tss use:

          "Window[formFactor=handheld]": {
              title: "Window handheld"
          }
          

      4. Compile the project and see similar code like the following:

          $.__views.id = Ti.UI.createWindow(function() {
              var o = {};
              _.extend(o, {});
              Alloy.isHandheld && _.extend(o, {
                  title: "Window handheld"
              });
              _.extend(o, {});
              Alloy.isHandheld && _.extend(o, {
                  title: "Window handheld"
              });
              _.extend(o, {
                  id: "id"
              });
              return o;
          }());
          

      The empty _.extend(o, {}); and the identical isHandheld lines should not be there.

        Attachments

          Activity

            People

            • Assignee:
              skypanther Tim Poulsen
              Reporter:
              fokkezb Fokke Zandbergen
            • Watchers:
              3 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