Saravananscope / dragtable

Automatically exported from code.google.com/p/dragtable
0 stars 0 forks source link

absolutePosition failing on ex in IE6 sometimes #19

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. I can't publish my test case (part of a much bigger and very complex
project).  However I can say that my table is embedded deeply in some divs,
the two most proximal ones are both position:relative.  Parent is overflow
auto and grandparent is overflow:hidden.
2. When I click to drag, the "shadow" column starts out at correct ey
position, but ex always starts at left most edge of table (e.g., ex=0).  
3. This is not a problem in FireFox 3+

What is the expected output? What do you see instead?
"Shadow" column appearing at correct ex position over actual column.
It does drag back and forth ok, but offset way to the left.

What version of the product are you using? In what browser?
v1.0 June 26, 2008.  IE6

If this is a bug, please include the URL for a page that demonstrates the
bug.
I wish I could.

Please provide any additional information below.
Here is what I patched in which corrected the problem for ex (but, Im sure,
defeated some of the important new logic in absolutePosition)...

 absolutePosition: function(elt, stopAtRelative) {
   var ex = 0, ey = 0;

   obj = elt // JFK Patch...
   if ((obj) && (obj.offsetParent)) {
    curleft = obj.offsetLeft
    while (obj = obj.offsetParent) {
     curleft += obj.offsetLeft
     }
    }

   do {
     var curStyle = dragtable.browser.isIE ? elt.currentStyle
                                           : window.getComputedStyle(elt, '');
     var supportFixed = !(dragtable.browser.isIE &&
                          dragtable.browser.version < 7);
     if (stopAtRelative && curStyle.position == 'relative') {
       break;
     } else if (supportFixed && curStyle.position == 'fixed') {
       // Get the fixed el's offset
       ex += parseInt(curStyle.left, 10);
       ey += parseInt(curStyle.top, 10);
       // Compensate for scrolling
       ex += document.body.scrollLeft;
       ey += document.body.scrollTop;
       // End the loop
       break;
     } else {
       ex += elt.offsetLeft;
       ey += elt.offsetTop;
     }
   } while (elt = elt.offsetParent);

// return {x: ex, y: ey};
   return {x: curleft, y: ey}; // JFK Patch
 },

Original issue reported on code.google.com by jfk...@gmail.com on 26 Aug 2009 at 5:14

GoogleCodeExporter commented 8 years ago
Sigh.  In an even more complex app, my hack just made things worse.  At least 
it's
consistent now between IE and FF: the initial position of the "shadow" column is
offset to the right of the target column by maybe about the width of the column.

If I have time, I'll try to create a test case on this.  I'll try to pack my 
table in
some position:relative divs and see if I can duplicate.

BTW: my more complex app lives in Dojo-land.

Original comment by jfk...@gmail.com on 26 Aug 2009 at 5:51