Kai345: Code-Verbesserung u.Test gewünscht

Beitrag lesen

Grütze .. äh ... Grüße!

Hab's mir mal kurz angesehen. Der Code scheint mir soweit ok.

Dazu noch eine Frage, die mir schon beim Schreiben des Codes eingefallen ist:

Ich habe sämtliche Operationen erst einmal mit lokalen Variablen durchgeführt und erst ganz zum Schluß "public" gemacht. Hat das irgendwelche Vor/Nachteile gegenüber Operationen an einer public variable (z.B. daß erst jedes Mal nachgesehen werden müßte, was z.B. "this" ist

also

function Konstruktor() {  
  var foo1 = document.createElement("div");  
  foo1.style.irgendwas = "irgendwas";  
  foo1.id = "bar";  
  this.foo = foo1;  
}

oder

function Konstruktor() {  
  var xy = this;  
  var foo1 = document.createElement("div");  
  foo1.style.irgendwas = "irgendwas";  
  foo1.id = "bar";  
  xy.foo = foo1;  
}

oder

function Konstruktor() {  
  this.foo = document.createElement("div");  
  this.foo.style.irgendwas = "irgendwas";  
  this.foo.id = "bar";  
}

oder

function Konstruktor() {  
  var xy = this;  
  xy.foo = document.createElement("div");  
  xy.foo.style.irgendwas = "irgendwas";  
  xy.foo.id = "bar";  
}  

oder ist das mehr oder weniger akademisch?


Kai

--
What is the difference between Scientology and Microsoft? One is an
evil cult bent on world domination and the other was begun by L. Ron
Hubbard.
ie:{ fl:( br:< va:) ls:? fo:| rl:? n4:° ss:{ de:] js:| ch:? mo:| zu:|