Hi everyone,
I am currently trying to use qx.bom.element.Scroll.intoView to scroll an
element into view in the main window and completely failing. My window
doesn't scroll at all both under Safari and Firefox.

After taking a look at the code and logging lots of stuff, I really don't
understand how it is supposed to work.

Excerpt from qx.bom.element.Scroll:
----------------
intoViewY : function(element, stop, align)
{
    var parent = element.parentNode;
    var doc = qx.dom.Node.getDocument(element);
    var body = doc.body;

           […]

    while (parent && parent != stop)
       {
               if (parent.scrollHeight > parent.clientHeight && (parent ===
body || qx.bom.element.Overflow.getY(parent) != "visible"))
               {
                       [Main work code]
               }
               parent = parent.parentNode;
       }
}
----------------

When the parent chain reaches body, body.scrollHeight and body.clientHeight
are always equal, both under FF and Safari, whatever the size of the
(viewport) main window, and so no work is ever done and nothing scrolls into
view.

As a fast and dirty workaround, if I replace
----------------
               if (parent.scrollHeight > parent.clientHeight && (parent ===
body || qx.bom.element.Overflow.getY(parent) != "visible"))
----------------
with
----------------
      if ((parent.scrollHeight > parent.clientHeight && (parent === body ||
qx.bom.element.Overflow.getY(parent) != "visible")) || (parent.scrollHeight
> window.innerHeight && (parent === body)))
----------------
it seems to work as expected.

I guess I'd like someone to confirm it is a bug, because I am not sure my
expectations as to how this function should work are correct and I don't see
how this bug could not have been detected before if anyone uses this
function.

Thanks in advance,

-- 
David Leray
------------------------------------------------------------------------------
All the data continuously generated in your IT infrastructure contains a
definitive record of customers, application performance, security
threats, fraudulent activity and more. Splunk takes this data and makes
sense of it. Business sense. IT sense. Common sense.
http://p.sf.net/sfu/splunk-d2dcopy1
_______________________________________________
qooxdoo-devel mailing list
qooxdoo-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel

Reply via email to