Update of /cvsroot/dynapi/dynapi/src/lib/dynapi/api
In directory usw-pr-cvs1:/tmp/cvs-serv8873
Modified Files:
dynlayer.js browser.js
Log Message:
- speed fixed in createElement (also changed static methods back to prototype
methods.. seems a bit faster.. not much though)
- changed all browser if statements, there's now a new is.def browser property which
is true when a default browser is used.. this includes IE and NS6/DOM.. these are now
handled first and by default, which should also be faster
Index: dynlayer.js
===================================================================
RCS file: /cvsroot/dynapi/dynapi/src/lib/dynapi/api/dynlayer.js,v
retrieving revision 1.27
retrieving revision 1.28
diff -C2 -r1.27 -r1.28
*** dynlayer.js 2001/02/15 15:15:00 1.27
--- dynlayer.js 2001/02/24 13:18:44 1.28
***************
*** 34,172 ****
}
- // Static Properties/Methods
DynLayer.unassigned=[];
DynLayer.nullCount=0;
! DynLayer.createElement=function(dlyr) {
! if (dlyr.created||!dlyr.parent||dlyr.elm!=null) return;
! if (dlyr.parent.isDocument) dlyr.dyndoc=dlyr.parent; else
dlyr.dyndoc=dlyr.parent.dyndoc;
! var lyr;
! if (is.ns4) {
! var recycled=dlyr.parent.doc.recycled;
! if (recycled && recycled.length>0) {
! lyr=recycled[0];
! DynAPI.removeFromArray(recycled,recycled[0]);
} else {
! lyr=new Layer(dlyr.w,dlyr.parent.elm);
! lyr.captureEvents(Event.LOAD);
! lyr.onload=function() {};
}
! } else var
parentElement=(dlyr.parent.isDynLayer)?dlyr.parent.elm:dlyr.parent.doc.body;
! if (is.ie4) {
! var code='<DIV id="'+dlyr.id+'" style="position:absolute; left:0px;
top:0px; width:'+dlyr.w+'px;"></DIV>';
! parentElement.insertAdjacentHTML("beforeEnd", code);
! lyr=parentElement.children[parentElement.children.length-1];
! } else if (is.ie5 || is.ns6) {
! lyr=dlyr.dyndoc.doc.createElement("DIV");
! lyr.style.position="absolute";
! lyr.id=dlyr.id;
! parentElement.appendChild(lyr);
! }
! DynLayer.flagPrecreate(dlyr);
! DynLayer.assignElement(dlyr,lyr);
! if (is.ns4) dlyr.elm.moveTo(dlyr.x,dlyr.y);
! else {
! dlyr.css.left=dlyr.x;
! dlyr.css.top=dlyr.y;
! }
! if (dlyr.bgColor!=null) dlyr.setBgColor(dlyr.bgColor);
! if (dlyr.bgImage!=null) dlyr.setBgImage(dlyr.bgImage)
! else if (is.ie55 && dlyr.bgImage==null && dlyr.html==null)
dlyr.setBgImage('javascript:null');
! if (dlyr.clip) {
! if (is.ns4) {
! var c=dlyr.elm.clip;
! c.top=dlyr.clip[0], c.right=dlyr.clip[1],
c.bottom=dlyr.clip[2], c.left=dlyr.clip[3];
} else {
! dlyr.setClip(dlyr.clip);
}
! }
! if (dlyr.z!=null) dlyr.css.zIndex=dlyr.z;
! dlyr.css.visibility=dlyr.visible? "inherit" : (is.ns4?"hide":"hidden");
! if (dlyr.w!=null) dlyr.setWidth(dlyr.w, false);
! if (dlyr.h!=null) dlyr.setHeight(dlyr.h, false);
! if (is.ns4) {
! dlyr.doc.write(dlyr.getInnerHTML());
! dlyr.doc.close();
! } else if (is.ie || is.dom) {
! dlyr.setHTML(dlyr.getInnerHTML(),false);
! }
! DynLayer.assignChildren(dlyr);
! if (dlyr.html!=null && (dlyr.w==null || dlyr.h==null)) {
! if (dlyr.w==null && dlyr.getContentWidth()>0)
dlyr.setWidth(dlyr.getContentWidth(), false);
! if (dlyr.h==null && dlyr.getContentHeight()>0)
dlyr.setHeight(dlyr.getContentHeight(), false);
! }
! dlyr.created=true;
! if (dlyr.hasEventListeners) dlyr.captureMouseEvents();
! dlyr.invokeEvent('create');
! dlyr.invokeEvent("resize");
! };
! DynLayer.deleteElement = function(dlyr) {
! DynLayer.flagDeleteChildren(dlyr);
! if (dlyr.elm) {
! if (is.ns4) {
! dlyr.elm.visibility = "hide";
! dlyr.elm.releaseEvents(Event.LOAD);
! } else {
! dlyr.elm.style.visibility = "hidden";
! dlyr.elm.innerHTML = "";
! dlyr.elm.outerHTML = "";
! if (is.ie5 && is.platform=="win32" &&
dlyr.elm.children.length>0) dlyr.elm.removeNode(true);
! }
! }
! dlyr.elm = null;
! dlyr.doc = null;
! dlyr.css = null;
! dlyr.created = false;
! };
! DynLayer.assignElement=function(dlyr,elm) {
! dlyr.elm=elm;
! if (is.ns4) {
! dlyr.css=elm;
! dlyr.doc=elm.document;
! dlyr.doc.lyrobj=dlyr;
! }
! else if (is.ie || is.dom) {
! dlyr.css=dlyr.elm.style;
! dlyr.doc=dlyr.parent.doc;
}
! dlyr.elm.lyrobj=dlyr;
! if (is.ns4) {
! for (var i in dlyr.doc.images) dlyr.doc.images[i].lyrobj=dlyr;
! for (i=0;i<dlyr.doc.links.length;i++) dlyr.doc.links[i].lyrobj=dlyr;
}
! };
! DynLayer.assignChildren=function(dlyr) {
! for (var i=0; i<dlyr.children.length; i++) {
! var child=dlyr.children[i];
! if (is.ns4) var elm=dlyr.doc.layers[child.id];
! else if (is.ns6) var elm=dlyr.doc.getElementById(child.id);
! else if (is.ie) var elm=dlyr.elm.all[child.id];
! DynLayer.assignElement(child,elm);
! DynLayer.assignChildren(child);
if (child.html!=null && (child.w==null || child.h==null)) {
if (child.w==null && child.getContentWidth()>0)
child.setWidth(child.getContentWidth(),false);
if (child.h==null && child.getContentHeight()>0)
child.setHeight(child.getContentHeight(),false);
}
if (child.z!=null) child.css.zIndex=child.z;
child.created=true;
if (child.hasEventListeners) child.captureMouseEvents();
child.invokeEvent('create');
- child.invokeEvent("resize");
}
};
! DynLayer.flagPrecreate=function(dlyr) {
! for (var i=0; i<dlyr.children.length; i++) {
! DynLayer.flagPrecreate(dlyr.children[i]);
! }
! dlyr.invokeEvent('precreate');
}
! DynLayer.flagDeleteChildren=function(dlyr) {
! for (var i=0; i<dlyr.children.length; i++) {
! if (dlyr.children[i].created)
DynLayer.flagDeleteChildren(dlyr.children[i]);
}
! dlyr.invokeEvent('delete');
};
- // End Static Properties/Methods
DynLayer.prototype.isDynLayer = true;
--- 34,171 ----
}
DynLayer.unassigned=[];
DynLayer.nullCount=0;
! DynLayer.prototype.createElement=function() {
! if (this.created||!this.parent||this.elm!=null) return;
! if (this.parent.isDocument) this.dyndoc=this.parent; else
this.dyndoc=this.parent.dyndoc;
!
! if (is.def) {
! var
parentElement=(this.parent.isDynLayer)?this.parent.elm:this.parent.doc.body;
! if (is.ie4) {
! var code='<DIV id="'+this.id+'" style="position:absolute;
left:0px; top:0px; width:'+this.w+'px;"></DIV>';
! parentElement.insertAdjacentHTML("beforeEnd", code);
!
this.elm=parentElement.children[parentElement.children.length-1];
! this.css=this.elm.style;
} else {
!
parentElement.appendChild(this.elm=this.dyndoc.doc.createElement("DIV"));
! this.elm.style.position="absolute";
! this.elm.id=this.id;
! this.css=this.elm.style;
}
! this.doc=this.parent.doc;
! } else {
! var recycled=this.parent.doc.recycled;
! if (recycled && recycled.length>0) {
! this.elm=recycled[0];
! DynAPI.removeFromArray(recycled,recycled[0]);
} else {
! this.elm=new Layer(this.w,this.parent.elm);
! this.elm.captureEvents(Event.LOAD);
! this.elm.onload=function() {};
}
! this.css=this.elm;
! this.doc=this.elm.document;
! this.doc.lyrobj=this;
! for (var i in this.doc.images) this.doc.images[i].lyrobj=this;
! for (i=0;i<this.doc.links.length;i++) this.doc.links[i].lyrobj=this;
! }
! this.elm.lyrobj=this;
! this.flagPrecreate(this);
! if (is.def) {
! this.css.left=this.x;
! this.css.top=this.y;
! this.setHTML(this.getInnerHTML(),false);
! if (this.w) this.css.width=this.w;
! if (this.h) this.css.height=this.h;
! if (!this.clip) this.css.clip='rect(0px '+(this.w||0)+'px
'+(this.h||0)+'px 0px)';
! } else if (is.ns4) {
! this.elm.moveTo(this.x,this.y);
! this.doc.write(this.getInnerHTML());
! this.doc.close();
! if (this.w) this.css.clip.width=this.w;
! if (this.h) this.css.clip.width=this.h;
}
! if (this.bgColor!=null) this.setBgColor(this.bgColor);
! if (this.bgImage!=null) this.setBgImage(this.bgImage);
! else if (is.ie55 && this.bgImage==null && this.html==null)
this.setBgImage('javascript:null');
! if (this.clip) this.setClip(this.clip)
! if (this.z!=null) this.css.zIndex=this.z;
! this.css.visibility=this.visible? "inherit" : (is.ns4?"hide":"hidden");
! this.assignChildren();
!
! if (this.html!=null) {
! if (this.w==null && this.getContentWidth()>0)
this.setWidth(this.getContentWidth(), false);
! if (this.h==null && this.getContentHeight()>0)
this.setHeight(this.getContentHeight(), false);
! }
! this.created=true;
! if (this.hasEventListeners) this.captureMouseEvents();
! this.invokeEvent('create');
! this.invokeEvent("resize");
! };
! DynLayer.prototype.deleteElement=function() {
! this.flagDeleteChildren(this);
! if (this.elm) {
! if (is.def) {
! this.elm.style.visibility = "hidden";
! this.elm.innerHTML = "";
! this.elm.outerHTML = "";
! if (is.ie5 && is.platform=="win32" &&
this.elm.children.length>0) this.elm.removeNode(true);
! } else if (is.ns4) {
! this.elm.visibility = "hide";
! this.elm.releaseEvents(Event.LOAD);
! }
}
! this.elm = null;
! this.doc = null;
! this.css = null;
! this.created = false;
! };
! DynLayer.prototype.assignElement=function(elm) {
! this.elm=elm;
! if (is.def) {
! this.css=this.elm.style;
! this.doc=this.parent.doc;
! } else if (is.ns4) {
! this.css=elm;
! this.doc=elm.document;
! this.doc.lyrobj=this;
! for (var i in this.doc.images) this.doc.images[i].lyrobj=this;
! for (i=0;i<this.doc.links.length;i++) this.doc.links[i].lyrobj=this;
! }
! this.elm.lyrobj=this;
! };
! DynLayer.prototype.assignChildren=function() {
! var cl=this.children.length;
! for (var i=0; i<cl; i++) {
! var child=this.children[i];
! if (is.ns4) var elm=this.doc.layers[child.id];
! else if (is.ie) var elm=this.elm.all[child.id];
! else var elm=this.doc.getElementById(child.id);
! child.assignElement(elm);
! child.assignChildren();
if (child.html!=null && (child.w==null || child.h==null)) {
if (child.w==null && child.getContentWidth()>0)
child.setWidth(child.getContentWidth(),false);
if (child.h==null && child.getContentHeight()>0)
child.setHeight(child.getContentHeight(),false);
}
+ child.invokeEvent("resize");
if (child.z!=null) child.css.zIndex=child.z;
child.created=true;
if (child.hasEventListeners) child.captureMouseEvents();
child.invokeEvent('create');
}
};
! DynLayer.prototype.flagPrecreate=function() {
! var cl=this.children.length
! for (var i=0; i<cl; i++) { this.children[i].flagPrecreate(); }
! this.invokeEvent('precreate');
}
! DynLayer.prototype.flagDeleteChildren=function() {
! for (var i=0; i<this.children.length; i++) {
! if (this.children[i].created) this.children[i].flagDeleteChildren();
}
! this.invokeEvent('delete');
};
DynLayer.prototype.isDynLayer = true;
***************
*** 177,240 ****
return
(this.created)?'DynAPI.getDocument("'+this.dyndoc.id+'").all["'+this.id+'"]':'DynLayer.unassigned["'+this.id+'"]';
};
! DynLayer.prototype.addChildID=function() {
! for (var a=0;a<arguments.length;a++) {
! var child=arguments[a];
! child.dyndoc=this.dyndoc;
! if (this.dyndoc.all[child.id]) {
! alert('Attempt to add "'+child.id+'" to the document
"'+this.dyndoc.id+'" failed.\n\nThe DynLayer already exists in that
DynDocument.\n\nYou must remove the dynlayer from its parent first.');
! return;
}
! for (var i=0;i<child.children.length;i++)
child.addChildID(child.children[i]);
! DynAPI.removeFromArray(DynLayer.unassigned,child,true);
! this.dyndoc.all[child.id]=child;
}
};
- DynLayer.prototype.addChild=function() {
- for (var a=0;a<arguments.length;a++) {
- var child=arguments[a];
- if (child.created) child.removeFromParent();
- child.parent=this;
- child.isChild=true;
- if (this.dyndoc) this.addChildID(child);
- this.children[this.children.length]=child;
- if (this.created) DynLayer.createElement(child);
- }
- return arguments[arguments.length-1];
- };
- DynLayer.prototype.removeChild=function() {
- for (var a=0;a<arguments.length;a++) {
- var child=arguments[a];
- if (child.parent==this) {
- DynAPI.removeFromArray(this.children,child);
- DynAPI.removeFromArray(this.dyndoc.all,child,true);
- DynLayer.unassigned[child.id]=child;
- DynLayer.deleteElement(child);
- child.parent=null;
- child.isChild=false;
- }
- }
- return arguments[arguments.length-1];
- };
- DynLayer.prototype.removeFromParent=function() {
- if (this.parent!=null) this.parent.removeChild(this);
- };
- DynLayer.prototype.deleteChild=function() {
- for (var a=0;a<arguments.length;a++) {
- var child=arguments[a];
- if (child.parent == this) {
- child.deleteAllChildren();
- child.invokeEvent('delete');
- DynAPI.removeFromArray(this.children,child);
- DynAPI.removeFromArray(this.dyndoc.all,child,true);
- if (is.ns4 && child.elm) {
- if (!this.doc.recycled) this.doc.recycled=[];
- this.doc.recycled[this.doc.recycled.length]=child.elm;
- }
- DynLayer.deleteElement(child);
- child.parent=null;
- child.isChild=false;
- }
- }
- };
DynLayer.prototype.deleteAllChildren=function() {
for (var i in this.children) {
--- 176,225 ----
return
(this.created)?'DynAPI.getDocument("'+this.dyndoc.id+'").all["'+this.id+'"]':'DynLayer.unassigned["'+this.id+'"]';
};
! DynLayer.prototype.addChildID=function(child) {
! child.dyndoc=this.dyndoc;
! if (this.dyndoc.all[child.id]) {
! alert('Attempt to add "'+child.id+'" to the document
"'+this.dyndoc.id+'" failed.\n\nThe DynLayer already exists in that
DynDocument.\n\nYou must remove the dynlayer from its parent first.');
! return;
! }
! for (var i=0;i<child.children.length;i++) child.addChildID(child.children[i]);
! DynAPI.removeFromArray(DynLayer.unassigned,child,true);
! this.dyndoc.all[child.id]=child;
! };
! DynLayer.prototype.addChild=function(child) {
! if (child.created) child.removeFromParent();
! child.parent=this;
! child.isChild=true;
! if (this.dyndoc) this.addChildID(child);
! this.children[this.children.length]=child;
! if (this.created) child.createElement();
! return child;
! };
! DynLayer.prototype.removeChild=function(child) {
! if (child.parent==this) {
! DynAPI.removeFromArray(this.children,child);
! DynAPI.removeFromArray(this.dyndoc.all,child,true);
! DynLayer.unassigned[child.id]=child;
! DynLayer.deleteElement(child);
! child.parent=null;
! child.isChild=false;
! }
! return child;
! };
! DynLayer.prototype.removeFromParent=function() { if (this.parent!=null)
this.parent.removeChild(this); };
! DynLayer.prototype.deleteChild=function(child) {
! if (child.parent == this) {
! child.deleteAllChildren();
! child.invokeEvent('delete');
! DynAPI.removeFromArray(this.children,child);
! DynAPI.removeFromArray(this.dyndoc.all,child,true);
! if (is.ns4 && child.elm) {
! if (!this.doc.recycled) this.doc.recycled=[];
! this.doc.recycled[this.doc.recycled.length]=child.elm;
}
! DynLayer.deleteElement(child);
! child.parent=null;
! child.isChild=false;
}
};
DynLayer.prototype.deleteAllChildren=function() {
for (var i in this.children) {
***************
*** 246,250 ****
this.doc.recycled[this.doc.recycled.length]=this.children[i].elm;
}
! DynLayer.deleteElement(this.children[i]);
this.children[i].parent=null;
this.children[i].isChild=false;
--- 231,235 ----
this.doc.recycled[this.doc.recycled.length]=this.children[i].elm;
}
! this.children[i].deleteElement(this.children[i]);
this.children[i].parent=null;
this.children[i].isChild=false;
***************
*** 261,286 ****
return s;
};
! if (is.ns4) {
DynLayer.prototype.getOuterHTML=function(dlyr) {
- var s='\n<layer id="'+dlyr.id+'"';
- if (dlyr.visible==false) s+=' visibility="hide"';
- if (dlyr.x!=null) s+=' left='+dlyr.x;
- if (dlyr.y!=null) s+=' top='+dlyr.y;
- if (dlyr.w!=null) s+=' width='+dlyr.w;
- if (dlyr.h!=null) s+=' height='+dlyr.h;
- if (dlyr.clip) s+='
clip="'+dlyr.clip[3]+','+dlyr.clip[0]+','+dlyr.clip[1]+','+dlyr.clip[2]+'"';
- else if (dlyr.w!=null && dlyr.h!=null);
- s+=' clip="0,0,'+dlyr.w+','+dlyr.h+'"';
- if (dlyr.z) s+=' zIndex='+dlyr.z;
- if (dlyr.bgImage!=null) s+=' background="'+dlyr.bgImage+'"';
- if (dlyr.bgColor!=null) s+=' bgcolor="'+dlyr.bgColor+'"';
- s+='>';
- if (dlyr.html!=null) s+=dlyr.html;
- for (var i=0; i<dlyr.children.length; i++)
s+=this.getOuterHTML(dlyr.children[i]);
- s+='</layer>';
- return s;
- };
- } else {
- DynLayer.prototype.getOuterHTML=function(dlyr) {
var s='<div id="'+dlyr.id+'" style="';
if (dlyr.visible==false) s+=' visibility:hidden;';
--- 246,251 ----
return s;
};
! if (is.def) {
DynLayer.prototype.getOuterHTML=function(dlyr) {
var s='<div id="'+dlyr.id+'" style="';
if (dlyr.visible==false) s+=' visibility:hidden;';
***************
*** 302,305 ****
--- 267,290 ----
return s;
};
+ } else if (is.ns4) {
+ DynLayer.prototype.getOuterHTML=function(dlyr) {
+ var s='\n<layer id="'+dlyr.id+'"';
+ if (dlyr.visible==false) s+=' visibility="hide"';
+ if (dlyr.x!=null) s+=' left='+dlyr.x;
+ if (dlyr.y!=null) s+=' top='+dlyr.y;
+ if (dlyr.w!=null) s+=' width='+dlyr.w;
+ if (dlyr.h!=null) s+=' height='+dlyr.h;
+ if (dlyr.clip) s+='
+clip="'+dlyr.clip[3]+','+dlyr.clip[0]+','+dlyr.clip[1]+','+dlyr.clip[2]+'"';
+ else if (dlyr.w!=null && dlyr.h!=null);
+ s+=' clip="0,0,'+dlyr.w+','+dlyr.h+'"';
+ if (dlyr.z) s+=' zIndex='+dlyr.z;
+ if (dlyr.bgImage!=null) s+=' background="'+dlyr.bgImage+'"';
+ if (dlyr.bgColor!=null) s+=' bgcolor="'+dlyr.bgColor+'"';
+ s+='>';
+ if (dlyr.html!=null) s+=dlyr.html;
+ for (var i=0; i<dlyr.children.length; i++)
+s+=this.getOuterHTML(dlyr.children[i]);
+ s+='</layer>';
+ return s;
+ };
};
DynLayer.prototype.setStyle=function (s) {
***************
*** 313,345 ****
this.setVisible(v!='hidden');
};
DynLayer.prototype.moveTo=function(x,y) {
! this.x=x!=null ? x : this.x;
! this.y=y!=null ? y : this.y;
if (this.css==null) return;
! if (is.ns) {
! this.css.left=this.x;
! this.css.top=this.y;
! }
! else {
! this.css.pixelLeft=this.x;
! this.css.pixelTop=this.y;
! }
this.invokeEvent('move');
};
DynLayer.prototype.moveBy=function(x,y) {
this.moveTo(this.x+x,this.y+y);
- };
- DynLayer.prototype.setX=function(x) {
- this.moveTo(x,null);
- };
- DynLayer.prototype.setY=function(y) {
- this.moveTo(null,y);
};
! DynLayer.prototype.getX=function() {
! return this.x
! };
! DynLayer.prototype.getY=function() {
! return this.y
! };
DynLayer.prototype.getPageX=function() {
if (this.css==null) return null;
--- 298,323 ----
this.setVisible(v!='hidden');
};
+ 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; }
+ }
DynLayer.prototype.moveTo=function(x,y) {
! if (x!=null) this.x=x;
! if (y!=null) this.y=y;
if (this.css==null) return;
! this._setX();
! this._setY();
this.invokeEvent('move');
};
DynLayer.prototype.moveBy=function(x,y) {
this.moveTo(this.x+x,this.y+y);
};
! DynLayer.prototype.setX=function(x) { this.moveTo(x,null); };
! DynLayer.prototype.setY=function(y) { this.moveTo(null,y); };
! DynLayer.prototype.getX=function() { return this.x; };
! DynLayer.prototype.getY=function() { return this.y; };
DynLayer.prototype.getPageX=function() {
if (this.css==null) return null;
***************
*** 413,447 ****
return this.bgColor;
};
! DynLayer.prototype.setHTML=function(html,noevt) {
! this.html=html?html:'';
! if (this.platform=='mac') this.html+='\n'
! if (this.css==null) return;
! if (noevt!=false) this.invokeEvent("beforeload");
! if (is.ns4) {
! this.doc.open();
! this.doc.write(html);
! this.doc.close();
for (var i in this.doc.images) this.doc.images[i].lyrobj=this;
for (i=0;i<this.doc.links.length;i++) this.doc.links[i].lyrobj=this;
}
! else if (is.ns6) {
while (this.elm.hasChildNodes())
this.elm.removeChild(this.elm.firstChild);
var r=this.elm.ownerDocument.createRange();
r.selectNodeContents(this.elm);
r.collapse(true);
! var df=r.createContextualFragment(html);
this.elm.appendChild(df);
}
! else {
! this.elm.innerHTML=html;
! }
if (noevt!=false) this.invokeEvent("load");
! };
DynLayer.prototype.getHTML=function() {
return this.html;
};
DynLayer.prototype.setSize = function(w,h,noevt) {
! if (w!=null) this.setWidth(w,false)
! if (h!=null) this.setHeight(h,false)
if (noevt!=false) this.invokeEvent('resize');
};
--- 391,432 ----
return this.bgColor;
};
! if (is.ns4) {
! DynLayer.prototype._setHTML=function(html) {
! sTmp=(this.w==null)?'<NOBR>'+this.html+'</NOBR>':this.html
! this.doc.open()
! this.doc.write(sTmp)
! this.doc.close()
for (var i in this.doc.images) this.doc.images[i].lyrobj=this;
for (i=0;i<this.doc.links.length;i++) this.doc.links[i].lyrobj=this;
}
! } else if (is.ie) {
! DynLayer.prototype._setHTML=function(html) { for (i in
this.elm.all.tags("img")) this.elm.all.tags("img")[i].lyrobj=this }
! } else {
! DynLayer.prototype._setHTML=function(html) {;
! sTmp=(this.w==null)?'<NOBR>'+this.html+'</NOBR>':this.html;
while (this.elm.hasChildNodes())
this.elm.removeChild(this.elm.firstChild);
var r=this.elm.ownerDocument.createRange();
r.selectNodeContents(this.elm);
r.collapse(true);
! var df=r.createContextualFragment(sTmp);
this.elm.appendChild(df);
+ for (i in this.doc.images) this.doc.images[i].lyrobj=this.elm;
}
! }
! DynLayer.prototype.setHTML=function(html,noevt) {
! this.html=html?html:'';
! if (this.platform=='mac') this.html+='\n';
! if (this.css==null) return;
! if (noevt!=false) this.invokeEvent("beforeload");
! this.elm.innerHTML=html;
! this._setHTML(html);
if (noevt!=false) this.invokeEvent("load");
! }
DynLayer.prototype.getHTML=function() {
return this.html;
};
DynLayer.prototype.setSize = function(w,h,noevt) {
! if (w!=null) this.setWidth(w,false);
! if (h!=null) this.setHeight(h,false);
if (noevt!=false) this.invokeEvent('resize');
};
***************
*** 478,492 ****
DynLayer.prototype.getContentWidth=function() {
if (this.elm==null) return 0;
! else if (is.ns4) return this.doc.width;
! else if (is.ns6) return this.elm.offsetWidth;
! else if (is.ie) return parseInt(this.elm.scrollWidth);
! else return 0;
};
DynLayer.prototype.getContentHeight=function() {
if (this.elm==null) return 0;
! else if (is.ns4) return this.doc.height;
! else if (is.ns6) return this.elm.offsetHeight;
! else if (is.ie) return parseInt(this.elm.scrollHeight);
! else return 0;
};
DynLayer.prototype.setClip=function(clip) {
--- 463,479 ----
DynLayer.prototype.getContentWidth=function() {
if (this.elm==null) return 0;
! else {
! if (is.ns4) return this.doc.width;
! else if (is.ie) return parseInt(this.elm.scrollWidth);
! else return this.elm.offsetWidth;
! };
};
DynLayer.prototype.getContentHeight=function() {
if (this.elm==null) return 0;
! else {
! if (is.ns4) return this.doc.height;
! else if (is.ie) return parseInt(this.elm.scrollHeight);
! else return this.elm.offsetHeight;
! }
};
DynLayer.prototype.setClip=function(clip) {
***************
*** 497,501 ****
var c=this.css.clip;
if (is.ns4) c.top=clip[0], c.right=clip[1], c.bottom=clip[2], c.left=clip[3];
! else if (is.ie || is.ns6) this.css.clip="rect("+clip[0]+"px "+clip[1]+"px
"+clip[2]+"px "+clip[3]+"px)";
};
DynLayer.prototype.getClip=function() {
--- 484,488 ----
var c=this.css.clip;
if (is.ns4) c.top=clip[0], c.right=clip[1], c.bottom=clip[2], c.left=clip[3];
! else this.css.clip="rect("+clip[0]+"px "+clip[1]+"px "+clip[2]+"px
"+clip[3]+"px)";
};
DynLayer.prototype.getClip=function() {
Index: browser.js
===================================================================
RCS file: /cvsroot/dynapi/dynapi/src/lib/dynapi/api/browser.js,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -r1.8 -r1.9
*** browser.js 2001/02/04 20:03:24 1.8
--- browser.js 2001/02/24 13:18:44 1.9
***************
*** 22,25 ****
--- 22,26 ----
this.opera=(this.b=="opera");
this.dom=((document.createRange&&(document.createRange().createContextualFragment))?true:false);
+ this.def=(this.ie||this.dom); // most used browsers, for faster if loops
var ua=navigator.userAgent.toLowerCase();
if (ua.indexOf("win")>-1) this.platform="win32";
_______________________________________________
Dynapi-CVS mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/dynapi-cvs