prototypejs / prototype

Prototype JavaScript framework
http://prototypejs.org/
Other
3.54k stars 640 forks source link

getOffsetParent bug in ie7 #239

Closed jwestbrook closed 9 years ago

jwestbrook commented 10 years ago

previous lighthouse ticket #1226 by Peter Schrammel


After an update from 1.6.1 to 1.7 some of our autosuggest fields were missplaced. I found that under some weird circumstances getParentOffset returns the HTML element and that seems not to have a viewportOffset (at least it's always 0 0).

After a quick patch in getParentOffset:

 var isInline = (Element.getStyle(element, 'display') === 'inline');
- if (!isInline && element.offsetParent) return $(element.offsetParent);
+ if (!isInline && element.offsetParent) return isHtml(element.offsetParent) ? $(document.body) : $(element.offsetParent);

Before discussing the patch can anybody confirm this bug?

jwestbrook commented 10 years ago

Patrick Wilkes April 19th, 2011 @ 02:12 AM

I have found the exact same problem - same symptom with autocomplete in IE6 & 7, and traced to the same line in getOffsetParent. I had coded the exact same fix before I found this ticket. Affecting both our autocomplete fields - they can appear at various places in the page, and the problem is the same wherever they are.

jwestbrook commented 10 years ago

Carson Reinke January 23rd, 2012 @ 09:07 PM

The above patch worked for me also in IE 7.