enyojs/enyo — pull request #899 by graynorton (2014-10-22 00:09:38+00:00)
Title: ENYO-371: Attempts to set scroll position fail in certain cases

enyo.Scroller attempts to honor requests to set scroll position
(via setScrollTop() and setScrollLeft()) even when the scroller is
hidden. However, it fails to do so in some cases (e.g. when the
Scroller itself is showing, but one of its ancestors is hidden,
or when a DOM ancestor of Scroller does certain types of async
things in response to onShowingChanged, like a subkind of
enyo.Popup that animates on show / hide).

The latter case can be avoided with thoughtful design of the
subkind (e.g. moon.Popup, which also animates when showing / hiding
but doesn't have this issue), but it would be nice to be more
bullet-proof.

To achieve better results, we replace Scroller's position caching /
restoring mechanism with a simpler mechanism based on the
onShowingChanged event of enyo.Control (which lets Controls
respond when an ancestor is shown or hidden, but which didn't exist
when Scroller was originally implemented).

To make this work, I adjusted the timing of onShowingChanged.
Previously, a Control would consistently waterfall this event after
hiding / showing itself. However, descendants will be able to do
more useful things with the event if we waterfall *before* hiding
(when a descendant can still take measurements or perform DOM
operations requiring a visible node), but *after* showing (again,
so that a descendant has a visible DOM node to work with as
needed).

This commit also includes a new utility function (isNumeric()) in
lang.js. This was required by a fix that I ended up rejecting, but
it seems like it might be useful in other cases so I am leaving it
here.

Enyo-DCO-1.1-Signed-Off-By: Gray Norton (gray.norton@lge.com)