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


Groups > comp.lang.javascript > #11559

Re: getComputedStyle vs currentStyle with IE 9

Path csiph.com!x330-a1.tempe.blueboxinc.net!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!border3.nntp.dca.giganews.com!Xl.tags.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!local2.nntp.dca.giganews.com!nntp.westnet.com.au!news.westnet.com.au.POSTED!not-for-mail
NNTP-Posting-Date Fri, 10 Feb 2012 06:48:28 -0600
Date Fri, 10 Feb 2012 23:48:19 +1100
From Andrew Poulos <ap_prog@hotmail.com>
User-Agent Mozilla/5.0 (Windows NT 6.0; rv:10.0) Gecko/20120129 Thunderbird/10.0
MIME-Version 1.0
Newsgroups comp.lang.javascript
Subject Re: getComputedStyle vs currentStyle with IE 9
References <F6-dnVFAkI3TmqjSnZ2dnUVZ_sidnZ2d@westnet.com.au> <2541188.UZlinSPExI@PointedEars.de>
In-Reply-To <2541188.UZlinSPExI@PointedEars.de>
Content-Type text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding 7bit
Message-ID <0ZKdnfcGHO2Bj6jSnZ2dnUVZ_rSdnZ2d@westnet.com.au> (permalink)
Lines 27
X-Usenet-Provider http://www.giganews.com
NNTP-Posting-Host 124.168.23.144
X-Trace sv3-Lo9z3L1hkzQnNqh3rXl8OPhuGEjJ4/+TzrwpK5Dw6v6jWkAwPw6JrqxsXD8ERnww4N1W4QZq68PdNMa!AE+xP+JSt7Eov7VsEhrGqit9AI+M1Bi9yGk6xkQ93tFrz4NAoh2XxFfWVipfi8ZESGjFd2/pvyka!YShAvUAPglq4qAr0E0/law==
X-Complaints-To abuse@westnet.com.au
X-Abuse-and-DMCA-Info Please be sure to forward a copy of ALL headers
X-Abuse-and-DMCA-Info Otherwise we will be unable to process your complaint properly
X-Postfilter 1.3.40
X-Original-Bytes 1982
Xref x330-a1.tempe.blueboxinc.net comp.lang.javascript:11559

Show key headers only | View raw


On 10/02/2012 11:38 PM, Thomas 'PointedEars' Lahn wrote:
> Andrew Poulos wrote:
>
>> Alas, IE 9 supports window.getComputedStyle but not camel-cased CSS
>> property names. So I tried this
>>
>> function getElStyle(el, IEcssPropName, cssPropName) {
>>     if (window.getComputedStyle) {
>>       return document.defaultView.getComputedStyle(el,
>> null).getPropertyValue(cssPropName) ||
>>              document.defaultView.getComputedStyle(el,
>> null).getPropertyValue(IEcssPropName);
>>
>>     } else if (el.currentStyle) {
>>       return el.currentStyle[IEcssPropName];
>>     }
>>
>>     return null;
>> }
>>
>> and it seems to work. Is there a better way?
>
> Yes.

Good, could you tell what it is?

Andrew Poulos

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


Thread

getComputedStyle vs currentStyle with IE 9 Andrew Poulos <ap_prog@hotmail.com> - 2012-02-10 23:02 +1100
  Re: getComputedStyle vs currentStyle with IE 9 Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2012-02-10 13:38 +0100
    Re: getComputedStyle vs currentStyle with IE 9 Andrew Poulos <ap_prog@hotmail.com> - 2012-02-10 23:48 +1100
      Re: getComputedStyle vs currentStyle with IE 9 Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2012-02-10 13:55 +0100
        Re: getComputedStyle vs currentStyle with IE 9 Andrew Poulos <ap_prog@hotmail.com> - 2012-02-11 06:48 +1100
          Re: getComputedStyle vs currentStyle with IE 9 Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2012-02-10 23:46 +0100
            Re: getComputedStyle vs currentStyle with IE 9 Tim Streater <timstreater@greenbee.net> - 2012-02-10 22:51 +0000
              Re: getComputedStyle vs currentStyle with IE 9 Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2012-02-11 11:55 +0100
            Re: getComputedStyle vs currentStyle with IE 9 Andrew Poulos <ap_prog@hotmail.com> - 2012-02-11 23:13 +1100
              Re: getComputedStyle vs currentStyle with IE 9 Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2012-02-11 14:41 +0100
                Re: getComputedStyle vs currentStyle with IE 9 Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2012-02-11 15:21 +0100
                Re: getComputedStyle vs currentStyle with IE 9 Andrew Poulos <ap_prog@hotmail.com> - 2012-02-12 19:04 +1100
                Re: getComputedStyle vs currentStyle with IE 9 Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2012-02-12 10:59 +0100
  Re: getComputedStyle vs currentStyle with IE 9 Captain Paralytic <paul_lautman@yahoo.com> - 2012-02-10 05:37 -0800

csiph-web