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


Groups > comp.lang.javascript > #11570

Re: getComputedStyle vs currentStyle with IE 9

Message-ID <1953157.aqSPkdTlGX@PointedEars.de> (permalink)
From Thomas 'PointedEars' Lahn <PointedEars@web.de>
Organization PointedEars Software (PES)
Date 2012-02-10 23:46 +0100
Subject Re: getComputedStyle vs currentStyle with IE 9
Newsgroups comp.lang.javascript
References <F6-dnVFAkI3TmqjSnZ2dnUVZ_sidnZ2d@westnet.com.au> <2541188.UZlinSPExI@PointedEars.de> <0ZKdnfcGHO2Bj6jSnZ2dnUVZ_rSdnZ2d@westnet.com.au> <5429156.TnbMflxdSq@PointedEars.de> <5umdnQMO8OI36ajSnZ2dnUVZ_oKdnZ2d@westnet.com.au>
Followup-To comp.lang.javascript

Followups directed to: comp.lang.javascript

Show all headers | View raw


Andrew Poulos wrote:

> On 10/02/2012 11:55 PM, Thomas 'PointedEars' Lahn wrote:
>> Andrew Poulos wrote:
>>> 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?
>> Yes.
>>
>> (This would actually be funny for me if it was not so disappointing.)
> 
> Its disappointing to me as well.

All you need to do is asking a *smart* question.


PointedEars
-- 
var bugRiddenCrashPronePieceOfJunk = (
    navigator.userAgent.indexOf('MSIE 5') != -1
    && navigator.userAgent.indexOf('Mac') != -1
)  // Plone, register_function.js:16

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