Titanium JIRA Archive
Alloy (ALOY)

[ALOY-547] TSS selector Widget doesn't work like Require does

GitHub Issuen/a
Resolution Date2013-03-18T21:15:11.000+0000
Affected Version/sn/a
Fix Version/sAlloy 1.1.0, 2013 Sprint 06
ComponentsRuntime, XML
Labelsalloy, require, tss, widget
ReporterFokke Zandbergen
AssigneeTony Lukasavage


Assuming you have an index.xml like:
    <Widget src="my.allow.widget" id="myId" />
And an index.tss like:
"Widget": {
  top: 50
The compiled index.js will contain:
$.__views.myId = Alloy.createWidget("my.allow.widget", "widget", {
  id: "myId"
While the following index.tss:
"Require": {
  top: 50
Results in the expected:
$.__views.myId = Alloy.createWidget("my.allow.widget", "widget", {
  top: 50,
  id: "myId"
I've ran into more examples where <Widget /> does not inherit all functionality of <Require /> in a correct way. Maybe it would be good idea just to replace <Widget /> by <Require type="widget" /> as the first step in compilation so we don't have to take care of <Widget /> anymore in the further compilation process?


  1. Tony Lukasavage 2013-03-18

    If you look at the parser, it is in fact just a call. The reason this issue surfaced is that I change the node name and type attribute to "widget" when I encounter the element, then pass the node into the parser, as widgets and requires are processed with the same parser. The problem with styling occurs because I later use a conditional based on the node name to determine what type of API is being styled. In your case above, the elements, but the time i was done manipulating, were actually . I made a fix to that conditional check and now you can generically apply styles to 's.
  2. Federico Casali 2013-04-09

    Verified fixed. Alloy 1.1.0-cr CLI version 3.1.0-cr TiSDK : 3.1.0.v20130408154547 (RC) Android and iOS

JSON Source