As bindActions
is evaluated before the click callback, the callback has no chance accessing the input
in the state it was when passed to the method.
The only way to do so is locking the state by holding a reference (like you smartly did), or wrapping the entire binding in a closure (terribly cumbersome and redundant), which will look like this:
private native void bindActions(JavaScriptObject save, JavaScriptObject input) /*-{
(function(in) {
$wnd.$(save).click(function () {
$wnd.alert($wnd.$(in).size());
});
})(input);
}-*/;
It's all about context; remember that inside the callback, you're referring to the function owner (which is save button). See the ridiculously famous article on quirksmode on the subject.