yui/yui3 — pull request #681 by Satyam (2013-04-30 16:54:12+00:00)
Title: Added isHidden method to determine if a cell or row is visible

For the cell editor, I had to hide the editor when the cell being edited is scrolled away. The code to determine if the cell is still visible relies too heavily in the particulars of the way scrolling is implemented so it could not reasonably remain with the cell editor with such a strong dependency.

The only public method that `datatable-scrollable` currently offers is `scrollTo`. I added `isHidden` to determine if the cell or row is visible or not.

To do so I broke apart the part of the code from `scrollTo` that locates the element to be scrolled to and put it in a shared `_locateTarget` method.

`isHidden` takes the same argument as `scrollTo` plus a `partially` flag to allow to ask whether the element is totally hidden (the default) or just partially covered.

I am not sure about the names. Should I provide `isHidden` or `isVisible` ? Perhaps it should be `isElementHidden` (it handles cells and rows so how could I refer to either?). Also, `_locateTarget` got that name because the local variable in `scrollTo` was called `target` but I can't claim the name is a good one. Suggestions are welcome.

While adding tests I noticed that `_locateTarget` could not locate a row by the `clientId` of the model it represents as the API docs claims so I added that.

I am also unsure of whether to provide that `partially` argument to `isHidden` is the right thing to do or if it would be better to provide different returns, for example, false or 0 for not hidden, true or 2 for totally hidden and 1 for partially hidden (which also evaluates to true if you are not particularly concerned). Or 0, 1 and -1.

I also found that `scrollTo` doesn't really scroll fully into view a cell beyond the right edge when there is a vertical scroll bar. `scrollIntoView` ignores that the vertical scroll bar is there so the cell gets at least partially hidden behind it. It makes `isHidden` fail because on all of the other edges, if you scroll to a cell, it gets completely visible while in this case, it gets at most partially visible.

I wonder if providing a `region` (like `node.get('region')`) would be a good idea.