Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-4644] iOS: New properties of Titanium.UI.View beginning with "get" always link to main object

GitHub Issuen/a
TypeBug
PriorityCritical
StatusClosed
ResolutionFixed
Resolution Date2012-04-25T07:42:51.000+0000
Affected Version/sn/a
Fix Version/sRelease 2.1.0, Sprint 2012-09 Core
ComponentsiOS
Labelscore, qe-testadded, view
ReporterMikhail Yurasov
AssigneeStephen Tramer
Created2011-06-15T18:01:05.000+0000
Updated2013-11-07T05:46:46.000+0000

Description

New properties of Titanium.UI.View beginning with "get" always link to main object
var myApp = {};

myApp.ui = {};

myApp.ui.createMyView = function() {
    var v = Ti.UI.createView({});
 
    v.getSomething = function() {
        return 100;
    };

    v._getSomething = function() {
        return 100;
    };
    
    v.getFood = 200;

    return v;
};

var myView = myApp.ui.createMyView();
alert(myView.getSomething); // [object TiUIView], shold be function
alert(myView.getSomething()); // nothing, shold be "100"
alert(myView._getSomething()); // "100" - OK
alert(myView.getFood); // [object TiUIView], shold be 200

Comments

  1. Paul Dowsett 2011-06-20

    In order for us to progress this issue, would you please edit the ticket as follows: * state your platform * state the version of the platform OS/SDK tested * state what you have tested it on - emulator or device * state your Titanium SDK version (including date + commit hash) * use the wiki markup provided, to reformat your code block (surround it with the \{code\} macro) Where possible, please use the fields provided for each piece of information Thanks
  2. Mikhail Yurasov 2011-06-21

    Platform: OS X 10.6.7 == Titanium Studio logs: [INFO] Titanium SDK version: 1.7.0 [INFO] iPhone Device family: universal [INFO] iPhone SDK version: 4.3 [INFO] iPhone simulated device: iphone [DEBUG] executing command: /usr/bin/killall iPhone Simulator ... [INFO] Launched application in Simulator (1.44 seconds) [DEBUG] executing command: xcodebuild -version [DEBUG] Xcode 4.0.2 [DEBUG] Build version 4A2002a [INFO] Found 4.3.2 patch installed == /Library/Application Support/Titanium/mobilesdk/version.txt: version=1.7.0 timestamp=06/06/11 18:05 githash=64155ee
  3. Matthew Apperson 2011-07-12

    Tested: There does appear to be a bug here
  4. Mikhail Yurasov 2011-09-12

    The same with properties beginning with "set"
  5. Paul Dowsett 2011-10-21

    Reassigning tickets, as per Tony Guntharp's request
  6. Stephen Tramer 2012-04-23

    Updated test:
       var myApp = {};
        
       myApp.ui = {};
        
       myApp.ui.createMyView = function() {
           var v = Ti.UI.createView({});
       	v.foo = 100;
         
           v.getSomething = function() {
               return v.foo;
           };
       
       	v.setSomething = function(val) {
       		v.foo = val;
       	}
            
           v.getFood = 200;
        
           return v;
       };
        
       var myView = myApp.ui.createMyView();
       
       Ti.API.info(myView.getSomething);
       Ti.API.info(myView.setSomething);
       Ti.API.info(myView.getFood);
       Ti.API.info(myView.getFoo);
       
       Ti.API.info(myView.getSomething())l
       myView.setSomething(50);
       Ti.API.info(myView.getSomething());
       
       Ti.API.info(myView.getFoo());
       myView.setFoo(10);
       Ti.API.info(myView.getFoo());
       
    Expected results:
       [INFO] <KrollCallback: [some address here]>
       [INFO] <KrollCallback: [some address here]>
       [INFO] 200
       [INFO] [object TiUIView]
       [INFO] 100
       [INFO] 50
       [INFO] 50
       [INFO] 10
       
  7. Dustin Hyde 2012-06-05

    Closing as Fixed. Verified as per Stramer's steps. SDK: 2.1.0.v20120605140359 Studio: 2.1.0.201206041625 OS: Snow Leopard Xcode: 4.2 Devices Tested: iPhone Simulator 5.0, iPad Simulator 4.3, iPad2 4.3.5
  8. Shameer Jan 2013-11-07

    Anvil testcase PR https://github.com/appcelerator/titanium_mobile/pull/4887

JSON Source