I was roaming through the core files.

And noticed that in most cases we start a prototype declaration first and
then branch off for the various browsers. However in some cases we are first
branching off and then declaring the prototype functions for each of the
browsers.

I can see why we would do this if we did not want a prototype for all
browsers thus we don't need an else {} block like is the case for:
if (is.def) {
        DynLayer.prototype.getOuterHTML()=function(){
                ....
        }
}else if (is.ns4){
        DynLayer.prototype.getOuterHTML()=function(){
                ....
        }
}

But why would we do this for prototype functions where we are prototyping
for all brouwsers with an else{} block, as is the case in:

if (is.ns) {
        DynLayer.prototype._setX=function(){ this.css.left=this.x; };
        DynLayer.prototype._setY=function(){ this.css.top=this.y; };
} else {
        DynLayer.prototype._setX=function(){ this.css.pixelLeft=this.x; };
        DynLayer.prototype._setY=function(){ this.css.pixelTop=this.y; };
};

Would it not be better style to write:

DynLayer.prototype._setX=function(){
        if (is.ns) {this.css.left=this.x;}
        else{this.css.pixelLeft=this.x;}
}
DynLayer.prototype._setY=function(){
        if (is.ns) {this.css.top=this.y;}
        else{this.css.pixelTop=this.y;}
}

Actually you also save a few bytes for all you byte counters.

Also for _setHTML, we currently have:

if (is.ns4) {
        DynLayer.prototype._setHTML=function(html) {
                ...
        }
} else if (is.ie) {
        DynLayer.prototype._setHTML=function(html) {
                ...
        }
} else {
        DynLayer.prototype._setHTML=function(html) {
                ...
        }
};

Would it not be better to have:

DynLayer.prototype._setHTML=function(html) {
        if (is.ns4) {
                ...
        }
        else if (is.ie) {
                ...
        }
        else {
                ...
        }
}

I think it is better style, and we save two lines of:
"DynLayer.prototype._setHTML=function(html)" for all you byte counters.

NanoFace =;^)










_______________________________________________
Dynapi-Dev mailing list
[EMAIL PROTECTED]
http://www.mail-archive.com/dynapi-dev@lists.sourceforge.net/

Reply via email to