From 6c6f8d39ea146bf2ce46ee8ec6c6a82bc435e40f Mon Sep 17 00:00:00 2001 From: Andrew Dupont Date: Thu, 26 Jun 2008 14:33:02 -0500 Subject: [PATCH] Coerce Opera's version string into a number whenever we need to sniff. [#163 state:resolved] --- CHANGELOG | 2 ++ src/dom.js | 11 +++++++++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index c76abce..c4a8583 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,5 @@ +* Coerce Opera's version string into a number whenever we need to sniff. [Sam Holman, jddalton] + * Ensure Object.isElement handles "falsy" values properly. (kangax) * Fix exiting test task on INT signal. (Samuel Lebeau) diff --git a/src/dom.js b/src/dom.js index ce87673..07ef2d6 100644 --- a/src/dom.js +++ b/src/dom.js @@ -1179,8 +1179,15 @@ document.viewport = { var dimensions = { }, B = Prototype.Browser; $w('width height').each(function(d) { var D = d.capitalize(); - dimensions[d] = (B.WebKit && !document.evaluate) ? self['inner' + D] : - (B.Opera && opera.version() < 9.5) ? document.body['client' + D] : document.documentElement['client' + D]; + if (B.WebKit && !document.evaluate) { + // Safari <3.0 needs self.innerWidth/Height + dimensions[d] = self['inner' + D]; + } else if (B.Opera && parseFloat(window.opera.version()) < 9.5) { + // Opera <9.5 needs document.body.clientWidth/Height + dimensions[d] = document.body['client' + D] + } else { + dimensions[d] = document.documentElement['client' + D]; + } }); return dimensions; },