Skip to main content

Bug Tracker

Side navigation

#6088 closed bug (fixed)

Opened February 12, 2010 04:34PM UTC

Closed September 22, 2010 08:42PM UTC

Last modified March 14, 2012 12:02AM UTC

Height/Width sometimes returns document dimensions in Opera

Reported by: lavignep Owned by:
Priority: Milestone: 1.4.3
Component: dimensions Version: 1.4.2
Keywords: height width opera Cc:
Blocked by: Blocking:

I seems that Opera (tested only on version 10) has a scrollTo function on some elements which defeats the

("scrollTo" in elem && elem.document) test in these methods.

Anyhow, any elements in any browsers could defeat this test.

Attachments (0)
Change History (8)

Changed February 18, 2010 04:35PM UTC by matzes comment:1

I have also a problem with returning document dimension in Opera.

When I disable the prototype-library it works fine on my website.

JS Bin - Testpage:

without prototype:

with prototype:


jQuery(function() {
  var i = jQuery("#test");
  i.text(".width() of red box: " + i.width() + "px (css: 300px)");

HTML (with prototype):

<!DOCTYPE html>
  <script  class="jsbin" src=""></script>
  <script class="jsbin" src=""></script>
<meta charset=utf-8 />
<title>Bug Test</title>
  #test { width:300px; background:#c00; }
  <div id="test"></div>

Changed March 15, 2010 06:48PM UTC by gbilotta comment:2

Same issue here. For some reason, the HTMLElement prototype seems to include all the window methods, so "does it walk and quack like a window?" becomes true even though the element is _not_ the window. The change was introduced in [6313] to make it work with non-main windows and documents, but it's a little too liberal.

A possible solution is to replace that line with:

  return ("scrollTo" in elem && elem.document && !elem.parentNode) ? // does it walk and quack like a window?

with the rationale that HTML elements have a parentNode while windows and documents don't.

Changed March 16, 2010 12:48AM UTC by gbilotta comment:3

Changed March 30, 2010 09:34AM UTC by kof13 comment:4

Thank you for the fix, its really a blocker.

Changed April 19, 2010 12:53AM UTC by dmethvin comment:5

need: ReviewCommit

Changed May 14, 2010 10:28PM UTC by sitkatech comment:6

Replying to [comment:3 gbilotta]:

Posted the fix here:

What's the status of this fix? Is it going to be committed to the central repository? We're having this problem and prefer not to be on a branch at this time. We've noticed this ticket was for milestone 1.4.2 but it never made it into the release. Any chance of getting this in to 1.4.3? Thanks...

Changed September 08, 2010 12:15PM UTC by phildriscoll comment:7

See also for a slightly different fix, and note that this problem occurs in two places in the jQuery source.

Changed September 22, 2010 08:42PM UTC by john comment:8

component: cssdimensions
resolution: → fixed
status: newclosed