Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.javascript > #11720
| Path | csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!gegeweb.42!gegeweb.eu!nntpfeed.proxad.net!proxad.net!feeder2-2.proxad.net!newsfeed.arcor.de!newsspool3.arcor-online.net!news.arcor.de.POSTED!not-for-mail |
|---|---|
| Content-Type | text/plain; charset="ISO-8859-1" |
| Message-ID | <2261546.FRqVoOGUtd@PointedEars.de> (permalink) |
| From | Thomas 'PointedEars' Lahn <PointedEars@web.de> |
| Reply-To | Thomas 'PointedEars' Lahn <cljs@PointedEars.de> |
| Organization | PointedEars Software (PES) |
| Date | Sun, 12 Feb 2012 10:59:46 +0100 |
| User-Agent | KNode/4.4.11 |
| Content-Transfer-Encoding | 7Bit |
| Subject | Re: getComputedStyle vs currentStyle with IE 9 |
| Newsgroups | comp.lang.javascript |
| Followup-To | 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> <1953157.aqSPkdTlGX@PointedEars.de> <gJmdnTVTqeAWxqvSnZ2dnUVZ_g-dnZ2d@westnet.com.au> <6101254.HsSKKp0Gan@PointedEars.de> <1395223.HDI7Dnh15d@PointedEars.de> <iLSdnWqUiawV76rSnZ2dnUVZ_qCdnZ2d@westnet.com.au> |
| Supersedes | <1936854.aqSPkdTlGX@PointedEars.de> |
| MIME-Version | 1.0 |
| Lines | 136 |
| NNTP-Posting-Date | 12 Feb 2012 10:59:47 CET |
| NNTP-Posting-Host | f4f23ca3.newsspool2.arcor-online.net |
| X-Trace | DXC=E`BONgC<28h>jlK2>IgHGdA9EHlD;3Ycb4Fo<]lROoRa8kF<OcfhCOkgUnZ0:D:6`jDZm8W4\YJNlb@mF9jNikde1BnN`o\a_gfDI3WgjAc6[m |
| X-Complaints-To | usenet-abuse@arcor.de |
| Xref | x330-a1.tempe.blueboxinc.net comp.lang.javascript:11720 |
Followups directed to: comp.lang.javascript
Show key headers only | View raw
Andrew Poulos wrote:
> On 12/02/2012 1:21 AM, Thomas 'PointedEars' Lahn wrote:
>> Thomas 'PointedEars' Lahn wrote:
>>> Andrew Poulos wrote:
>>>> I think you are misleading me as it doesn't look like there's a better
>>>> way.
>>> Wrong on both accounts. For crying out loud, a *closely related*
>>> question has been asked (presumably, *again*) on StackOverflow
>>> *yesterday*, and I
>
> So, I don't normally read StackOverflow.
OMG. Google is your friend!
> 1.
> document.defaultView.getComputedStyle(el,
> null).getPropertyValue("background-color")
Standards-compliant.
> 2.
> document.defaultView.getComputedStyle(el, null)["backgroundColor"]
Standards-compliant (but optional).
> 3. document.defaultView.getComputedStyle(el,
> null).getPropertyValue("backgroundColor")
Not standards-compliant, not supposed to work.
> 4.
> document.defaultView.getComputedStyle(el, null)["background-color"]
Not standards-compliant, not supposed to work.
> 5.
> el.currentStyle["background-color"]
MSHTML-proprietary, but not supposed to work this way.
> 6.
> el.currentStyle["backgroundColor"]
MSHTML-proprietary; supposed to work *there*.
> where 'el' is a DIV with a bg colour set and this is what I got:
>
> IE 9
> ----
> 1. correct colour
> 2. correct colour
> 3. ""
All as expected.
> 4. correct colour
> 5. correct colour
Both unexpected, but then again I never waste time testing *wrong*
approaches.
> 6. correct colour
As expected.
> Opera 11.61
> -----------
> 1. correct colour
> 2. correct colour
> 3. ""
> 4. undefined
> 5. undefined
> 6. correct colour
All as expected. Opera has a long history of emulating MSHTML while trying
to be standards-compliant at the same time.
> Safari 5.1.2
> ------------
> 1. correct colour
> 2. correct colour
> 3. null
> 4. correct colour
All as expected.
> 5. error
> 6. error
Of course it gives an error in WebCore. It's MSHTML-proprietary, for
goodness' sake!
> Firefox 10.0.1
> --------------
> 1. correct colour
> 2. correct colour
> 3. ""
> 4. undefined
All as expected.
> 5. error
> 6. error
See above. However, you have neglected to test potential differences
between Standards Compliance and Quirks Mode in all cases. It is possible
that `currentStyle' is available in Gecko's Quirks Mode as is
`document.all'.
> Chrome 17.0.963.46
> ------------------
> 1. correct colour
> 2. correct colour
> 3. null
> 4. correct colour
> 5. error
> 6. error
Chrome's/Chromium's layout engine is (based on) WebCore. See above.
> 1 and 2 appear to be the most consistent.
Few surprises (t)here.
> Thanks for the time you spent helping me on this.
Hm, hm.
PointedEars
--
realism: HTML 4.01 Strict
evangelism: XHTML 1.0 Strict
madness: XHTML 1.1 as application/xhtml+xml
-- Bjoern Hoehrmann
Back to comp.lang.javascript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll 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