Menu

#240 autoresizing with setHTML

open
nobody
5
2004-09-15
2004-09-15
Max
No

Let us consider the setting next HTML for DynLayer
which have not fixed size (we expect that layer should
be auto-resized to the content size):
var dlr = new DynLayer();
dlr.setHTML("Test<img
src='http://www.google.com/images/logo.gif'>");
dynapi.document.addChild(dlr);

If the image in HTML (<img
src='http://www.google.com/images/logo.gif'>) isn’t
cached by the browser early then we have problem with
auto-resizing of the layer.

The core place in code (I consider the case of DOM
browser only) is: dynlayer_dom.js, line 47, in function
DynLayer._assignElement, where we call
dlyr.setSize(cw,ch). At the moment of calling
_assignElement we have incorrect values for
getContentWidth and getContentHeight yet and so we set
the wrong size to the layer…

I think we should resize layer when the DynLayer
completes the job by loading all resources (images and
etc.) Unfortunately I don’t know how to detect the
finish of all jobs during the changing innerHTML of
element (our case)…

I attached the test file which doesn’t work on IE and
Mozilla…

Discussion

  • Max

    Max - 2004-09-15

    test

     
  • Doug Melvin

    Doug Melvin - 2005-09-01

    Logged In: YES
    user_id=184788

    Checking for completiong can be done in IE using the
    onreadystatechange event and then checking if readyState == 4

    I _think_ readystate 4 = finished rendering, but you will
    want to test to be sure.

    This event is not very well documented at all and was only
    found after about 4 months of trying to solve an "images
    abort loading" issue we where having oh-so long ago.

    Also note: I have absolutly no idea how to do this in
    Mozilla but give me time :-P

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.