Skip to content

Commit 4cba7aa

Browse files
committed
refactor(scrollView): use defaultPrevented
1 parent 1437534 commit 4cba7aa

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

Diff for: js/views/scrollView.js

+4-7
Original file line numberDiff line numberDiff line change
@@ -610,15 +610,15 @@ ionic.views.Scroll = ionic.views.View.inherit({
610610
self.scrollTo(0, elementScrollTop + elementHeight - (deviceHeight * 0.5), true);
611611
}
612612

613-
//Only the first scrollView parent of the element that broadcasted this event
613+
//Only the first scrollView parent of the element that broadcasted this event
614614
//(the active element that needs to be shown) should receive this event
615615
e.stopPropagation();
616616
});
617617

618618
if ('ontouchstart' in window) {
619619

620620
container.addEventListener("touchstart", function(e) {
621-
if (e.__scroller) {
621+
if (e.defaultPrevented) {
622622
return;
623623
}
624624
// Don't react if initial down happens on a form element
@@ -628,8 +628,6 @@ ionic.views.Scroll = ionic.views.View.inherit({
628628

629629
self.doTouchStart(e.touches, e.timeStamp);
630630
e.preventDefault();
631-
//We don't want to stop propagation, other things might want to know about the touchstart
632-
e.__scroller = true;
633631
}, false);
634632

635633
document.addEventListener("touchmove", function(e) {
@@ -648,7 +646,7 @@ ionic.views.Scroll = ionic.views.View.inherit({
648646
var mousedown = false;
649647

650648
container.addEventListener("mousedown", function(e) {
651-
if (e.__scroller) {
649+
if (e.defaultPrevented) {
652650
return;
653651
}
654652
// Don't react if initial down happens on a form element
@@ -661,8 +659,7 @@ ionic.views.Scroll = ionic.views.View.inherit({
661659
pageY: e.pageY
662660
}], e.timeStamp);
663661

664-
//We don't want to stop propagation, other things might want to know about the touchstart
665-
e.__scroller = true;
662+
e.preventDefault();
666663
mousedown = true;
667664
}, false);
668665

0 commit comments

Comments
 (0)