Skip to content
This repository has been archived by the owner on Apr 12, 2018. It is now read-only.

Commit

Permalink
Updated jQuery Mobile
Browse files Browse the repository at this point in the history
Signed-off-by: kosmas58 <kosmas.schuetz@gmx.com>
  • Loading branch information
kosmas58 committed Sep 4, 2011
1 parent a4bb916 commit 6c6f097
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 30 deletions.
39 changes: 25 additions & 14 deletions public/javascripts/jquery.mobile.js
Expand Up @@ -642,27 +642,35 @@
}

function triggerVirtualEvent(eventType, event, flags) {
var defaultPrevented = false,
ve;
var ve;

if (( flags && flags[ eventType ] ) ||
( !flags && getClosestElementWithVirtualBinding(event.target, eventType) )) {

ve = createVirtualEvent(event, eventType);

$(event.target).trigger(ve);

defaultPrevented = ve.isDefaultPrevented();
}

return defaultPrevented;
return ve;
}

function mouseEventCallback(event) {
var touchID = $.data(event.target, touchTargetPropertyName);

if (!blockMouseTriggers && ( !lastTouchID || lastTouchID !== touchID )) {
triggerVirtualEvent("v" + event.type, event);
var ve = triggerVirtualEvent("v" + event.type, event);
if (ve) {
if (ve.isDefaultPrevented()) {
event.preventDefault();
}
if (ve.isPropagationStopped()) {
event.stopPropagation();
}
if (ve.isImmediatePropagationStopped()) {
event.stopImmediatePropagation();
}
}
}
}

Expand Down Expand Up @@ -742,7 +750,8 @@
triggerVirtualEvent("vmouseup", event, flags);

if (!didScroll) {
if (triggerVirtualEvent("vclick", event, flags)) {
var ve = triggerVirtualEvent("vclick", event, flags);
if (ve && ve.isDefaultPrevented()) {
// The target of the mouse events that follow the touchend
// event don't necessarily match the target used during the
// touch. This means we need to rely on coordinates for blocking
Expand Down Expand Up @@ -1042,16 +1051,19 @@
return false;
}

var touching = true,
origTarget = event.target,
var origTarget = event.target,
origEvent = event.originalEvent,
timer;

function clearTapHandlers() {
touching = false;
function clearTapTimer() {
clearTimeout(timer);
}

function clearTapHandlers() {
clearTapTimer();

$this.unbind("vclick", clickHandler)
.unbind("vmouseup", clearTapTimer)
.unbind("vmousecancel", clearTapHandlers);
}

Expand All @@ -1066,12 +1078,11 @@
}

$this.bind("vmousecancel", clearTapHandlers)
.bind("vmouseup", clearTapTimer)
.bind("vclick", clickHandler);

timer = setTimeout(function() {
if (touching) {
triggerCustomEvent(thisObject, "taphold", event);
}
triggerCustomEvent(thisObject, "taphold", $.Event("taphold"));
}, 750);
});
}
Expand Down

0 comments on commit 6c6f097

Please sign in to comment.