if( !sky.containers ) sky.containers =
{
Window : function()
{
this.element = document.createElement("div");
this.element.modal = false;
this.element.height = 240;
this.element.draggable = true;
this.element.resizable = true;
this.element.position = "center";
this.element.width = 240;
this.element.target = document.body;
this.element.title ="";
this.element.headerHeight = 30;;
this.element.effects = {};
this.element.show = function()
return this.element;
}}
What is the keyword THIS in this context?”sky.containers” or “Window”?And what is ELEMENT,if theres no variable define whit this name?
Window() is a constructor function. That means it gets called when you create a new object with something like
Inside the function,
thiswill refer to the new object that was just created. (And which gets assigned tomyWinin the above example call.)As for ‘element’, it’s a property of the newly-created object. It doesn’t exist until this line:
Which creates a new <div> element and assigns the DOM representation of it to the property.