#6088 closed bug (fixed)
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: |
Description
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.
Change History (8)
comment:1 Changed 13 years ago by
comment:2 Changed 13 years ago by
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.
comment:3 follow-up: 6 Changed 13 years ago by
Posted the fix here: http://github.com/Oblomov/jquery/commit/f1fd7952743ce4a07a556f1f9a1ba175dd7bca5c
comment:5 Changed 13 years ago by
need: | Review → Commit |
---|
comment:6 Changed 13 years ago by
Replying to gbilotta:
Posted the fix here: http://github.com/Oblomov/jquery/commit/f1fd7952743ce4a07a556f1f9a1ba175dd7bca5c
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...
comment:7 Changed 13 years ago by
See also http://dev.jquery.com/ticket/6575#comment:5 for a slightly different fix, and note that this problem occurs in two places in the jQuery source.
comment:8 Changed 12 years ago by
Component: | css → dimensions |
---|---|
Milestone: | 1.4.2 → 1.4.3 |
Resolution: | → fixed |
Status: | new → closed |
Version: | 1.4.1 → 1.4.2 |
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: http://jsbin.com/eheju
with prototype: http://jsbin.com/eheju/2
JavaScript:
HTML (with prototype):