Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.javascript > #15394

Re: How to improve performance growing this <li>

Path csiph.com!usenet.pasdenom.info!gegeweb.org!eternal-september.org!feeder.eternal-september.org!mx04.eternal-september.org!.POSTED!not-for-mail
From Denis McMahon <denismfmcmahon@gmail.com>
Newsgroups comp.lang.javascript
Subject Re: How to improve performance growing this <li>
Date Fri, 17 Aug 2012 23:16:06 +0000 (UTC)
Organization A noiseless patient Spider
Lines 24
Message-ID <k0mjbm$7a7$1@dont-email.me> (permalink)
References <k0l3jr$qbu$1@speranza.aioe.org> <k0l3nh$qhe$1@speranza.aioe.org> <afas28dkk284q30s2gh9tacq25ptjjo9pu@4ax.com>
Mime-Version 1.0
Content-Type text/plain; charset=UTF-8
Content-Transfer-Encoding 8bit
Injection-Date Fri, 17 Aug 2012 23:16:06 +0000 (UTC)
Injection-Info mx04.eternal-september.org; posting-host="6c40735e39b19604a4465f1638664c8d"; logging-data="7495"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+3hozqB9dFgYFtzxiua/sSgXvWhRG7eJU="
User-Agent Pan/0.136 (I'm far too busy being delicious; GIT 926a150 git://git.gnome.org/pan2)
Cancel-Lock sha1:EibLHpejHWldYRdqYpvNvWqJljo=
Xref csiph.com comp.lang.javascript:15394

Show key headers only | View raw


On Fri, 17 Aug 2012 07:27:04 -0400, Dr.Kral wrote:

> If this hypothesis is correct, then you want to find a way to add many
> items at one time.  Perhaps just changing the innerHTML of the division?

How about (untested):

var oldList = document.getElementById( "listid" );
var newList = oldList.cloneNode( true );

for ( newItemText in textArray ) {
   newLi = document.createNode("li");
   newLiText = docuemnt.createTextNode( newItemText );
   newLi.appendChild( newLiText );
   newList.appendChild( newLi );
}

oldList.parentNode.replaceChild( oldList, newList );

Would this only re-render once when the list was replaced?

Rgds

Denis McMahon

Back to comp.lang.javascript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

How to improve performance growing this <li> "Richard Maher" <maher_rj@hotspamnotmail.com> - 2012-08-17 17:41 +0800
  Re: How to improve performance growing this <li> "Richard Maher" <maher_rj@hotspamnotmail.com> - 2012-08-17 17:43 +0800
    Re: How to improve performance growing this <li> Dr.Kral@nyc.rr.com - 2012-08-17 07:27 -0400
      Re: How to improve performance growing this <li> "Richard Maher" <maher_rj@hotspamnotmail.com> - 2012-08-18 06:18 +0800
      Re: How to improve performance growing this <li> Denis McMahon <denismfmcmahon@gmail.com> - 2012-08-17 23:16 +0000
        Re: How to improve performance growing this <li> Denis McMahon <denismfmcmahon@gmail.com> - 2012-08-18 00:33 +0000
          Re: How to improve performance growing this <li> Denis McMahon <denismfmcmahon@gmail.com> - 2012-08-18 11:05 +0000
            Re: How to improve performance growing this <li> SAM <stephanemoriaux.NoAdmin@wanadoo.fr.invalid> - 2012-08-18 16:57 +0200
              Re: How to improve performance growing this <li> Denis McMahon <denismfmcmahon@gmail.com> - 2012-08-18 16:23 +0000
                Re: How to improve performance growing this <li> Dr J R Stockton <reply1233@merlyn.demon.co.uk.invalid> - 2012-08-19 20:16 +0100
                Re: How to improve performance growing this <li> SAM <stephanemoriaux.NoAdmin@wanadoo.fr.invalid> - 2012-08-20 12:29 +0200
                Re: How to improve performance growing this <li> Dr J R Stockton <reply1234@merlyn.demon.co.uk.invalid> - 2012-08-21 20:44 +0100

csiph-web