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


Groups > comp.lang.javascript > #17372

Re: baffled trying to call style.display value

Message-ID <3709927.HS29Ki5Fzn@PointedEars.de> (permalink)
From Thomas 'PointedEars' Lahn <PointedEars@web.de>
Organization PointedEars Software (PES)
Date 2012-11-27 21:01 +0100
Subject Re: baffled trying to call style.display value
Newsgroups comp.lang.javascript
References <8b828e29-6604-45c7-9166-f17e5b39724d@googlegroups.com> <4620a8a4-7848-4ca7-941e-c826259acbac@googlegroups.com> <timstreater-AA2C37.17591527112012@news.individual.net>
Followup-To comp.lang.javascript

Followups directed to: comp.lang.javascript

Show all headers | View raw


Tim Streater wrote:

> JeffG <jeffgutsell@fuse.net> 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 <news:1788183.LAg6v8g3if@PointedEars.de>.  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, <f806at$ail$1$8300dec7@news.demon.co.uk>

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


Thread

baffled trying to call style.display value JeffG <jeffgutsell@fuse.net> - 2012-11-27 08:08 -0800
  Re: baffled trying to call style.display value Scott Sauyet <scott.sauyet@gmail.com> - 2012-11-27 08:20 -0800
    Re: baffled trying to call style.display value Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2012-12-10 01:24 +0100
      Re: baffled trying to call style.display value Scott Sauyet <scott.sauyet@gmail.com> - 2012-12-10 05:03 -0800
        Re: baffled trying to call style.display value Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2012-12-10 16:04 +0100
          Re: baffled trying to call style.display value Scott Sauyet <scott.sauyet@gmail.com> - 2012-12-10 08:54 -0800
            Re: baffled trying to call style.display value Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2012-12-10 19:36 +0100
          Re: baffled trying to call style.display value Stefan Weiss <krewecherl@gmail.com> - 2012-12-10 22:45 +0100
            Re: baffled trying to call style.display value Andrew Poulos <ap_prog@hotmail.com> - 2012-12-11 10:19 +1100
            Re: baffled trying to call style.display value Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2012-12-11 00:34 +0100
        Re: baffled trying to call style.display value Scott Sauyet <scott.sauyet@gmail.com> - 2012-12-10 07:39 -0800
          Re: baffled trying to call style.display value Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2012-12-10 17:10 +0100
  Re: baffled trying to call style.display value Jake Jarvis <pig_in_shoes@yahoo.com> - 2012-11-27 17:33 +0100
    Re: baffled trying to call style.display value Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2012-11-27 17:49 +0100
  Re: baffled trying to call style.display value JeffG <jeffgutsell@fuse.net> - 2012-11-27 09:38 -0800
    Re: baffled trying to call style.display value Tim Streater <timstreater@greenbee.net> - 2012-11-27 17:59 +0000
      Re: baffled trying to call style.display value Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2012-11-27 21:01 +0100
        Re: baffled trying to call style.display value Tim Streater <timstreater@greenbee.net> - 2012-11-27 22:32 +0000
          Re: baffled trying to call style.display value Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2012-11-27 23:50 +0100

csiph-web