Author: sergeyhalipov
Date: 2007-06-06 12:32:32 -0400 (Wed, 06 Jun 2007)
New Revision: 1055
Modified:
trunk/richfaces/suggestionbox/src/main/resources/org/richfaces/renderkit/html/scripts/suggestionbox.js
Log:
http://jira.jboss.com/jira/browse/RF-209
Modified:
trunk/richfaces/suggestionbox/src/main/resources/org/richfaces/renderkit/html/scripts/suggestionbox.js
===================================================================
---
trunk/richfaces/suggestionbox/src/main/resources/org/richfaces/renderkit/html/scripts/suggestionbox.js 2007-06-06
16:20:04 UTC (rev 1054)
+++
trunk/richfaces/suggestionbox/src/main/resources/org/richfaces/renderkit/html/scripts/suggestionbox.js 2007-06-06
16:32:32 UTC (rev 1055)
@@ -348,7 +348,12 @@
var item = entry;
var realOffset = 0;
while (item && (item != scroll)) {
- realOffset += item.offsetTop;
+ // Avoid bug in Safari. Details:
http://jacob.peargrove.com/blog/2006/technical/table-row-offsettop-bug-in...
+ if ("SAFARI" == RichFaces.navigatorType() && "TR" ==
item.tagName) {
+ realOffset += document.getElementsByClassName("dr-sb-cell-padding",
item)[0].offsetTop;
+ }
+ else
+ realOffset += item.offsetTop;
if (item.parentNode == scroll) break;
item = item.offsetParent;
}
@@ -356,8 +361,16 @@
LOG.debug("Scroll = " + scroll.scrollTop
+ " , reallOffset= " + realOffset
+ " scrollHeight= " + scroll.offsetHeight);
- if (realOffset > scroll.scrollTop + scroll.clientHeight -
entry.offsetHeight) {
- scroll.scrollTop = realOffset - scroll.clientHeight +
entry.offsetHeight;
+
+ var entryOffsetHeight;
+ if ("SAFARI" == RichFaces.navigatorType()) {
+ var tdElement = document.getElementsByClassName("dr-sb-cell-padding",
item)[0];
+ entryOffsetHeight = tdElement.offsetTop + tdElement.offsetHeight;
+ } else
+ entryOffsetHeight = entry.offsetHeight;
+
+ if (realOffset > scroll.scrollTop + scroll.clientHeight -
entryOffsetHeight) {
+ scroll.scrollTop = realOffset - scroll.clientHeight +
entryOffsetHeight;
} else if (realOffset < scroll.scrollTop) {
scroll.scrollTop = realOffset;
}