Turning on delayedClick by default. <again>

Added triggers for mousedown and mouse up in the delayed case because some of hte jqm components register handlers on those events to set the component states.

Note that the focus() trigger is commented out temporarily. It seems to cause the content within the scrollview clip to scroll to the point where item being focused sits in the flow .. unfortunately this screws up the rendering because we are using CSS3 translate, so the item clicked on is out of view.

Modified sv-test-02.html so that the clone event sets the target property on the fake event.
This commit is contained in:
Kin Blas 2010-12-16 11:04:48 -08:00
parent 8351f5496b
commit 49c9db9c49
2 changed files with 10 additions and 5 deletions

View file

@ -30,7 +30,7 @@ jQuery.widget( "mobile.scrollview", jQuery.mobile.widget, {
pagingEnabled: false,
delayedClickSelector: "a,input,textarea,select,button,.ui-btn",
delayedClickEnabled: false
delayedClickEnabled: true
},
_makePositioned: function($ele)
@ -284,8 +284,9 @@ jQuery.widget( "mobile.scrollview", jQuery.mobile.widget, {
var c = this._$clip;
var v = this._$view;
if (this.options.delayedClickEnabled)
if (this.options.delayedClickEnabled) {
this._$clickEle = $(e.target).closest(this.options.delayedClickSelector);
}
this._lastX = ex;
this._lastY = ey;
this._doSnapBackX = false;
@ -512,8 +513,12 @@ jQuery.widget( "mobile.scrollview", jQuery.mobile.widget, {
this._disableTracking();
if (this.options.delayedClickEnabled && !this._didDrag) {
this._$clickEle.click();
if (!this._didDrag && this.options.delayedClickEnabled && this._$clickEle.length) {
this._$clickEle
.trigger("mousedown")
//.trigger("focus")
.trigger("mouseup")
.trigger("click");
}
// If a view scrolled, then we need to absorb

View file

@ -81,7 +81,7 @@ var hu = $.mobile.scrollview.prototype._handleDragStop;
function getDummyEvent(o)
{
return { _pd: false, _sp: false, preventDefault: function(){ this._pd = true; }, stopPropagation: function(){ this._sp = true; }};
return { target: o.target, _pd: false, _sp: false, preventDefault: function(){ this._pd = true; }, stopPropagation: function(){ this._sp = true; }};
}
function updateEvent(e, cb_pd, cb_sp)