[EMAIL PROTECTED] wrote: > sure ! > > On 8 oct, 14:06, walden <[EMAIL PROTECTED]> wrote: >> Before I answer, is there a prize? >> >> On Oct 8, 3:36 am, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: >> >>> Hello ! >>> Do you know the difference between : >>> Element input = DOM.createInputText (); >>> DOM.insert(parentElement, input,0) >>> and >>> DOM.setinnerHtml (parentElement,"<input type="text">); >>> Thanks >>> Steph > > >
Seriously, setInnerHtml will overwrite anything already in parentElement, while insert() will simply add a new node at the beginning. setInnerHtml will also make use of the browsers parser and DOM builder, while using insert() means you have to build the entire DOM structure through JS. Building the DOM by hand as the advantage that you can keep references to the nodes, but setInnerHtml (especially when combined with the GWT StringBuilder class) is often faster. DOM can be re-edited later by simply changing attributes, or moving things round, where setInnerHtml will require the browser to re-parse the data. It's all a matter of taste and testing really. Just my 2c worth. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/Google-Web-Toolkit?hl=en -~----------~----~----~----~------~----~------~--~---
