Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!newsreader4.netcologne.de!news.netcologne.de!xlned.com!feeder1.xlned.com!newsfeed.arcor.de!newsspool1.arcor-online.net!news.arcor.de.POSTED!not-for-mail Content-Type: text/plain; charset="UTF-8" Message-ID: <3709927.HS29Ki5Fzn@PointedEars.de> From: Thomas 'PointedEars' Lahn Reply-To: Thomas 'PointedEars' Lahn Organization: PointedEars Software (PES) Date: Tue, 27 Nov 2012 21:01:05 +0100 User-Agent: KNode/4.4.11 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+&. <4620a8a4-7848-4ca7-941e-c826259acbac@googlegroups.com> Followup-To: comp.lang.javascript MIME-Version: 1.0 Lines: 31 NNTP-Posting-Date: 27 Nov 2012 21:01:06 CET NNTP-Posting-Host: a3385748.newsspool2.arcor-online.net X-Trace: DXC=WK;1PM?OAbXmG86`U=_nC_A9EHlD;3YcR4Fo<]lROoRQ8kFKPTZ7MIeLZm2S7LLV5VJEIU^ X-Complaints-To: usenet-abuse@arcor.de Xref: csiph.com comp.lang.javascript:17372 Tim Streater wrote: > JeffG wrote: >> This is incredibly helpful. I will make use of all your suggestions in >> various aspects of my project - not just this function. > > I had to deduce empirically that elementPtr.style gave incomplete > information, however I've yet to see any reason for that, good or bad. > Getting the required style info can be done, but seems to involve some > steps. For example: > > compPtr = document.getElementById (comp); > stylePtr = document.defaultView.getComputedStyle (compPtr, null); > height = parseInt (stylePtr.getPropertyValue ("height")); ^ Wrong, see . A fallback for MSHTML < 9 is also missing. It is usually better not to rely on the computed style; certainly it is not necessary here. It is also considered good style to let argument lists – by contrast to operands – be _not_ delimited by whitespace from the method property access: var height = parseInt(stylePtr.getPropertyValue("height"), 10); PointedEars -- Prototype.js was written by people who don't know javascript for people who don't know javascript. People who don't know javascript are not the best source of advice on designing systems that use javascript. -- Richard Cornford, cljs,