Update scrollTo non-windows scroll issue #64

Closed
wants to merge 1 commit into
from

Conversation

Projects
None yet
3 participants
@bckp

bckp commented Aug 31, 2012

This patch fix issue, where element with absolute position in relative container with overflow: scroll does not show and scrollTo is not work becouse it try to move page, but not parent element

Update scrollTo non-windows scroll issue
This patch fix issue, where element with absolute position in relative container with overflow: scroll does not show and scrollTo is not work becouse it try to move page, but not parent element
@savetheclocktower

This comment has been minimized.

Show comment Hide comment
@savetheclocktower

savetheclocktower Aug 31, 2012

Collaborator

Thanks for this.

I'm not going to apply it now because:

  1. It changes the behavior of Element.scrollTo, and I'd rather not do an API change until the next major release.
  2. If I did want to change the way that Element.scrollTo behaves, I'd want it to scroll the nearest scrollable container and ensure that that container is visible in the viewport.
  3. Your patch introduces a new public method called Element.getScrollParent, but I don't think that method is useful enough to be exposed to end users.

But I did create a ticket for this issue. Thanks!

Collaborator

savetheclocktower commented Aug 31, 2012

Thanks for this.

I'm not going to apply it now because:

  1. It changes the behavior of Element.scrollTo, and I'd rather not do an API change until the next major release.
  2. If I did want to change the way that Element.scrollTo behaves, I'd want it to scroll the nearest scrollable container and ensure that that container is visible in the viewport.
  3. Your patch introduces a new public method called Element.getScrollParent, but I don't think that method is useful enough to be exposed to end users.

But I did create a ticket for this issue. Thanks!

@victor-homyakov

This comment has been minimized.

Show comment Hide comment
@victor-homyakov

victor-homyakov Sep 28, 2012

Contributor

IMHO Element.getScrollParent will be as useful as other very specific methods (getOffsetParent cumulativeOffset cumulativeScrollOffset). They are needed for "middle users" (widget developers etc.). I already use such Element.getScrollParent in my code:

  function getScrollParent(element) {
    for (var parent = $(element).parentNode; parent; parent = parent.parentNode) {
      if (parent.scrollHeight > parent.offsetHeight) {
        parent = $(parent);
        var overflow = Element.getStyle(parent, "overflow");
        if (!overflow || overflow == "scroll") { // overflow:auto, overflow:scroll
          return parent;
        }
      }
    }
    return $(document.documentElement || document.body);
  }

P.S. I wanted also publicly accessible isDetached() (ticket 1029) and getPixelValue() (to make Element.Layout extensible).

Contributor

victor-homyakov commented Sep 28, 2012

IMHO Element.getScrollParent will be as useful as other very specific methods (getOffsetParent cumulativeOffset cumulativeScrollOffset). They are needed for "middle users" (widget developers etc.). I already use such Element.getScrollParent in my code:

  function getScrollParent(element) {
    for (var parent = $(element).parentNode; parent; parent = parent.parentNode) {
      if (parent.scrollHeight > parent.offsetHeight) {
        parent = $(parent);
        var overflow = Element.getStyle(parent, "overflow");
        if (!overflow || overflow == "scroll") { // overflow:auto, overflow:scroll
          return parent;
        }
      }
    }
    return $(document.documentElement || document.body);
  }

P.S. I wanted also publicly accessible isDetached() (ticket 1029) and getPixelValue() (to make Element.Layout extensible).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment