Skip to Content
0
Former Member
Apr 11, 2014 at 08:04 AM

How does UI5 Hides Object's prototype property ? !!!!!!!

337 Views

Hey All,

I'm just wondering how UI5 hides Javascript Object's prototype property !! I was just playing around with UI5 controls and encountered this.

  • Created a method 'Move' in the prototype of sap.m.Button.
  • Created a new instance for the Button 'oButton'.
  • oButton instance doesn't have the method Move which it is supposed to have.

sap.m.Button.prototype.Move = function(){
console.log('Move');
}
var oButton = new sap.m.Button({text:"Hello"});
oButton.Move(); // throws undefined function!


The Most interesting thing is the same code when executed in Browser console, works like a charm !

How is this possible ?


JS Bin - Collaborative JavaScript Debugging</title> <link rel="icon" href="http://static.jsbin.…