Path: csiph.com!feeder.erje.net!1.eu.feeder.erje.net!weretis.net!feeder1.news.weretis.net!news.solani.org!.POSTED!not-for-mail From: Thomas 'PointedEars' Lahn Newsgroups: comp.lang.javascript Subject: Re: Will insertBefore show it IMMEDIATELY? Supersedes: <1759281.AzHQRNGglN@PointedEars.de> Date: Fri, 06 May 2016 14:08:49 +0200 Organization: PointedEars Software (PES) Lines: 32 Message-ID: <2621985.gYTYDU9glv@PointedEars.de> References: <9f3351d4-6b6a-46f3-b086-41f39990ab7b@googlegroups.com> Reply-To: Thomas 'PointedEars' Lahn Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8Bit X-Trace: solani.org 1462536529 8101 eJwFwYkBwCAIA8CVKk8C40jU/UfoXToWxEAi8uVzXBbUgZM0mPHErdpjTfX6tPMMSVVFu+YHB/UQlg== (6 May 2016 12:08:49 GMT) X-Complaints-To: abuse@news.solani.org NNTP-Posting-Date: Fri, 6 May 2016 12:08:49 +0000 (UTC) User-Agent: KNode/4.14.2 Cancel-Key: sha1:oh5DoLjSDH2BCdf7YQtg5iE9CuM= X-User-ID: eJwNyckBAyEMA8CWfEkm5QAy/Zewme8g6bxdBAsP7ygXGD6W+0Cj+ulc3AmShtUxwpY2l5oW/+n0mHR7hcYHYI8VXw== Cancel-Lock: sha1:LU3VaMaQKFmuxOnM9Z48DkcW1Qw= X-NNTP-Posting-Host: eJwNysEBwCAIA8CVaiBBx1Eo+4+g7zuahjJclLPZnT+QynUKnh6jw7jnOvNDObRfYxvx3GR1ASIkENE= Xref: csiph.com comp.lang.javascript:30404 Christoph M. Becker wrote: > bit-naughty@hotmail.com wrote: >> My question is, if I use this, as instructed: >> insertBefore(newChild, >> refChild) method. >> >> Then will the element show up right away? >> I DON'T want it to, I want it to remain invisible till I fiddle with it's >> CSS properties.... > > Consider to use CSS for styling instead of doing this by scripting. The > script would only add (or remove) a class name, then. False dilemma. If newChild.style.display == "none" or document.defaultView.getComputedStyle(newChild, null).getPropertyValue("display") == "none", then even the dynamically inserted element will not be displayed immediately, and it may be necessary, depending on the use-case, to not have the element in the document tree from the beginning. However, you are correct that once the element is in the document tree, toggling its “display” property (or other CSS properties) should be done with class name toggling, unless there is a good reason not to. -- PointedEars FAQ: | SVN: Twitter: @PointedEars2 | ES Matrix: Please do not cc me. / Bitte keine Kopien per E-Mail.