Author: pyaschenko
Date: 2008-05-14 10:11:50 -0400 (Wed, 14 May 2008)
New Revision: 8576
Modified:
trunk/ui/suggestionbox/src/main/resources/org/richfaces/renderkit/html/scripts/suggestionbox.js
Log:
http://jira.jboss.com/jira/browse/RF-2543
Modified:
trunk/ui/suggestionbox/src/main/resources/org/richfaces/renderkit/html/scripts/suggestionbox.js
===================================================================
---
trunk/ui/suggestionbox/src/main/resources/org/richfaces/renderkit/html/scripts/suggestionbox.js 2008-05-14
13:26:24 UTC (rev 8575)
+++
trunk/ui/suggestionbox/src/main/resources/org/richfaces/renderkit/html/scripts/suggestionbox.js 2008-05-14
14:11:50 UTC (rev 8576)
@@ -978,6 +978,7 @@
RichFaces.Position = {
source: null,
target: null,
+
smartClone: function(source, target, options) {
this.options = Object.extend({
width: "auto"
@@ -1002,23 +1003,8 @@
var offsets = this.calcOffsets(this.source);
- var offsetTop = 0;
- var offsetLeft = 0;
- if (RichFaces.navigatorType() != RichFaces.MSIE)
- {
- var els = this.target.style;
- var originalVisibility = els.visibility;
- var originalDisplay = els.display;
- els.visibility = 'hidden';
- els.display = '';
- var offsetTop = this.target.offsetParent.scrollTop;
- var offsetLeft = this.target.offsetParent.scrollLeft;
- els.display = originalDisplay;
- els.visibility = originalVisibility;
- }
-
- Element.setStyle(this.target, Object.extend({"left":
(offsets["x"]+offsetLeft)
- + "px", "top": (offsets["y"]+offsetTop) +
"px"}, targetStyle));
+ Element.setStyle(this.target, Object.extend({"left":
(offsets["x"])
+ + "px", "top": (offsets["y"]) +
"px"}, targetStyle));
if (options.iframeId) {
var iframe = $(options.iframeId);
@@ -1034,9 +1020,38 @@
iframe.style.height = this.target.style.height;
}
},
+
+ cumulativeOffset: function(element) {
+ var valueT = 0, valueL = 0;
+ var fixedFlag = false;
+ do {
+ if (fixedFlag) {
+ fixedFlag = false;
+ valueT += element.scrollTop || 0;
+ valueL += element.scrollLeft || 0;
+ }
+ valueT += element.offsetTop || 0;
+ valueL += element.offsetLeft || 0;
+
+ var position = element.style['position'];
+ if (!position && element.currentStyle) {
+ position = element.currentStyle['position'];
+ }
+ else if (!position && document.defaultView &&
document.defaultView.getComputedStyle) {
+ var css = document.defaultView.getComputedStyle(element, null);
+ position = css ? css['position'] : null;
+ }
+ if (position == 'fixed') {
+ fixedFlag= true;
+ }
+ element = element.offsetParent;
+ } while (element);
+ return [valueL, valueT];
+ },
+
calcOffsets : function(element) {
- var offsetBase = element.cumulativeOffset();
+ var offsetBase = this.cumulativeOffset(element);
return {x: offsetBase[0], y: element.offsetHeight + offsetBase[1]};
},