From: Raymond I. <xw...@ya...> - 2003-04-10 17:07:47
|
Hi, I've noticed that the following will cause ns4 to return wrong results: <style> <!-- .yellowboxnumber { text-align:center; } --> </style> var box=dynapi.document.addChild(new DynLayer(null,0,0,776,169,'#666666')); var lyr=box.addChild(new DynLayer(i,x,y,null,null,'yellow')); lyr.setClass('yellowboxnumber'); If the width and height vaules are missing the getContentWidth/Height function will return incorrect values for the dynlayer. This is because of the lyr.setClass('yellowboxnumber') setting. It would appear that ns4 is very buggy when if comes on to style sheets. One quick solotion if to ensure that your width and height values are always set: var lyr=box.addChild(new DynLayer(i,x,y,30,20,'yellow')); On the other hand: <style> <!-- .yellowboxcommon { position:absolute; top:1px; width:30px; height:20px; clip:rect(0px 30px 20px 0px); background-color:yellow; layer-background-color:yellow; text-align:center; overflow:hidden; visibility:inherit; } --> </style> var box=dynapi.document.addChild(new DynLayer(null,0,0,776,169,'#666666')); for(var i=0;i<200;i++){ lyr=box.addChild(new DynLayer(i)); lyr.setID('yellowbox'+i); lyr.setClass('yellowboxcommon',true); } The above will cause ns4 to return incorrect getContentWidth/Height values. The "return this.css.clip.height;" and "return this.css.clip.width;" patch does not return the exact content width/height of the layer. Instead the laveyrs clip height/width is what is returned. This patch will also cause ordinary DynLayers to return incorrect content width/height values. One quick solution is to always set width and height values: lyr=box.addChild(new DynLayer(i,null,null,30,20)); In my opinion ns4 does not support the setClass property very well. If the above errors can't be fixed then I would suggest that this function be ignored for ns4 or that a warning be added to the docs about it's use with ns4. What do you all think? Can we fix this? -- Raymond Irving --- Kevin <ke...@ke...> wrote: > See below: > > "Raymond Irving" <xw...@ya...> wrote: > > Hi Kevin, > > > > Thanks for the fix. You can find it in cvs. > > > > One oher thing... Have you ever tried setting > left:0px > > and top:0px inside to style sheet with ns4 and the > new > > setClass() function? Does it position the layer to > > 0,0? > > > > On my windows system in ns4 it does not position > the > > layer to 0,0. > > If we can forget server side generation of pages and > any > mention of 'inline' and you are trying to absolute > or relative > position a DynLayer at 0,0 - I may be able to offer > some > ideas. > > First off, body margins can't be made less than the > default > in NS4 using <style>..</style> unless you override > in the > body tag. > <body leftmargin=0 topmargin=0 marginwidth=0 > marginheight=0> > This will give a clean sheet/canvas in IE and NS4 to > start using > <style>...</style> tags. Rendering at 0,0 is > possible with no other > body elements though my preference is to use an > inserted relative > container and start building the widget with > absolute positioned > children from 0,0 if required. > > I have fixed the > speedtest.dynlayer-setclass-basic.html > example and shown how I thought my design for > relative > positioning, object id and class styles would work. > Though > I am finding it more difficult on a larger scale > examples. > > There is a problem which I have fixed in > dynlayer_ns4.js as > getContentWidth and getContentHeight were not > returning > the correct clip width and height of the DynLayer. > Could > someone help with IE and DOM versions? > > I hope the example makes things clear. The problem > is after > page load when ._assignElement() is called and the > DynLayer > has no .w or .h because object id and class style > sheets were > used for the first 10 of 200 yellow boxes. > > Note the first yellow box has html=0 or null and > setSize() is > not called so that DynLayer appears OK? > > - > Kevin > > > -- > > Raymond Irving > > > > --- Kevin <ke...@ke...> wrote: > > > Hello, > > > > > > Attached patch.for: dynlayer_ns4.js: > getOuterHTML() > > > > > > - > > > Kevin > > > > > > > > > > > ATTACHMENT part 2 application/x-zip-compressed > > name=dynapi3x-patch2.zip > > > > > > > > __________________________________________________ > > Do you Yahoo!? > > Yahoo! Tax Center - File online, calculators, > forms, and more > > http://tax.yahoo.com > > > > > > > ------------------------------------------------------- > > This SF.net email is sponsored by: ValueWeb: > > Dedicated Hosting for just $79/mo with 500 GB of > bandwidth! > > No other company gives more support or power for > your dedicated server > > > http://click.atdmt.com/AFF/go/sdnxxaff00300020aff/direct/01/ > > _______________________________________________ > > Dynapi-Dev mailing list > > Dyn...@li... > > > http://www.mail-archive.com/dyn...@li.../ > > ATTACHMENT part 2 application/x-zip-compressed name=dynapi3x-update2.zip __________________________________________________ Do you Yahoo!? Yahoo! Tax Center - File online, calculators, forms, and more http://tax.yahoo.com |