Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!newsfeed.datemas.de!uucp.gnuu.de!newsfeed.arcor.de!newsspool2.arcor-online.net!news.arcor.de.POSTED!not-for-mail Content-Type: text/plain; charset="UTF-8" Message-ID: <4035931.IXUBZ7Uc5o@PointedEars.de> From: Thomas 'PointedEars' Lahn Reply-To: Thomas 'PointedEars' Lahn Organization: PointedEars Software (PES) Date: Sat, 19 Oct 2013 23:45:41 +0200 User-Agent: KNode/4.10.5 Content-Transfer-Encoding: 8Bit X-Face: %i>XG-yXR'\"2P/C_aO%~;2o~?g0pPKmbOw^=NT`tprDEf++D.m7"}HW6.#=U:?2GGctkL,f89@H46O$ASoW&?s}.k+&. <0cc5ab2c-9864-4ee8-8306-1d5eaf1e0849@googlegroups.com> MIME-Version: 1.0 Lines: 60 NNTP-Posting-Date: 19 Oct 2013 23:45:57 CEST NNTP-Posting-Host: 8de870a4.newsspool4.arcor-online.net X-Trace: DXC=hWAb6TgmMlCgj[ZPFj7ehO4IUK To Une Bévue Will you *please* learn to quote? > this one is the case why using innerHTML property is not very reliable for > READS, only for WRITES, that is, if you inject or ADD the elements to the > document by using .innerHTML, the WRITE, that is, the ADDITION goes fine, > but if you try to read any of the elements, like retriving by using the ID > or even crawling the document tree to it, won't work very well. Nonsense. > for instances in which you need to READ elements or access elements added > to the document, do not use the .innerHTML property, instead use the DOM > methods like .createElement() and .appendChild() and .createTextNode(). Nonsense. The issue with the “innerHTML” is not unreliable read access; it is mostly proprietary subtree serialization. But that has nothing to do with the fact that you can add elements with “+=”; it is just inefficient because previous siblings need to be serialized. > Long as the DOM methods may be, and often maybe even redundantly worded, > they're very reliable when accessing or adding elements to the document. Very likely the issue here is the common one that the element with ID “growlnotifications” has not been parsed yet when this.growlnotifications = document.getElementById('growlnotifications'); is executed. As a result, this.growlnotifications is assigned “null”, and the assignment in this.setText = function (text) { this.growlnotifications.innerHTML = text; }; fails with something like |> (null).answer = "42"; | TypeError: Cannot set property 'answer' of null Therefore, your suggestion will not work. this.setText = function (text) { document.getElementById('growlnotifications').innerHTML=text; }; works because the element object reference is not retrieved before the setText() method is called, after the element has been parsed. The solution is not to call the wrapper constructor before the element has been parsed; it should be called in the “load” event listener for the “body” element instead. -- PointedEars Twitter: @PointedEars2 Please do not Cc: me. / Bitte keine Kopien per E-Mail.