ComputedStyle bug in Firefox

Mozilla Firefox
Jul
31

Mozilla Firefox uses the W3C method of accessing the DOM to retrieve the computed styles of an element. A computed style refers to styles applied to an element that were not from JavaScript or inline; instead from a stylesheet. As you would expect, the method for doing this varies between Internet Explorer and Firefox and both methods for the most part work. Though the problem is that it doesn't work properly in Firefox; the background-position property is not accessible using the following code:

var elem = document.getElementById('test');
document.defaultView.getComputedStyle(elem, null)
    .getPropertyValue('background-position');

True enough, IE can not get the background-position either, but it can get it as seperate components backgroundPositionX and backgroundPositionY, which Firefox cannot.

Looking at Bugzilla they have fixed the problem, though it's not in a release yet; not even the 2.0.0.6 that was released today which is just the following security updates:

  • MFSA 2007-27 Unescaped URIs passed to external programs
  • MFSA 2007-26 Privilege escalation through chrome-loaded about:blank windows

Maybe it will be fixed in Firefox 3, I've not tried the Beta for that yet. As it happens, Safari is still incapable of supporting either method.

your comments - Post a comment

blog comments powered by Disqus