Forum: Rails Spinoffs (closed, excessive spam) Prototype 1.6.0.2 + Opera 9.50 + document.viewport.getDimensions();

4f5e9de6b84752fed90cf305e3eb15c1?d=identicon&s=25 ehsmeng (Guest)
on 2008-06-25 16:59
(Received via mailing list)
Hi,

It seems like document.viewport.getDimensions() reports the entire
page size rather than the viewport on my Opera 9.50.
document.viewport.getDimensions() works as expected on IE6-7, FF2-3
etc. Could anyone confirm this?

Best regards,
Marcus
Ee26fb04f058d0a0da16ac1b6d066933?d=identicon&s=25 jdetaeye (Guest)
on 2008-07-07 18:55
(Received via mailing list)
I noticed the same behavior and patched my copy of the prototype.js
file:
...
document.viewport = {
  getDimensions: function() {
    var dimensions = { };
    var B = Prototype.Browser;
    $w('width height').each(function(d) {
      var D = d.capitalize();
      dimensions[d] = (B.WebKit && !document.evaluate) ? self['inner'
+ D] :
          (B.Opera && parseFloat(opera.version)<9.5) ?
document.body['client' + D]) : document.documentElement['client' + D];
          document.documentElement['client' + D];
    });
    return dimensions;
  },
...

The original code has:
    (B.Opera)
as the condition, which I changed to:
    (B.Opera && parseFloat(opera.version)<9.5)

Regards,

Johan
299a3d891ff1920b69c364d061007043?d=identicon&s=25 jdalton (Guest)
on 2008-07-07 19:20
(Received via mailing list)
This has been patched for the next release (1.6.0.3) :)
http://github.com/sstephenson/prototype/tree/maste...

- JDD
This topic is locked and can not be replied to.