I have 2 problems with Prototype's <new Element> method. 1. I have a lot of DOM elements created manualy with <new Element>. I have already about 1000 lines of code with just <new Element>. When I added it to the dome with <body.appendChild(root)> it takes a lot of time to insert. How to optimize it? May be it's better to use simple HTML (may be with <new Template>) and then PUT in on DOM. But how? Is there any body.appendChild(HTML) method? As I can imaging appendChild takes a DOM element as a parameter ;-) 2. I need computation of width and height of elements created by the <new Element> method. As you may know, first of all, I should add my element in DOM, SHOW it and then get width and height. But, as I just say, I'm creating a lot of <new Elements> in my script and some of them SHOULD not be displayed before one point ;-) But the other elements (childs, as you can imaging) should get width and height. So, I'm adding <new Elements> to the DOM first of all and SHOW it every time. But, Opera start render this elements before the script ends execution (Firefox, Safari do it in opposite direction), so I have a very ugly effect, where hundreds of elements renders "on fly". I mean, all of this elements MUST be rendered after script is finished. I know, that I should just hide the root of my elements, but how to compute width and height after that? Thank you for your patient ;-)
on 2008-07-12 12:58