pukhalski / tap

1Kb library for easy unified handling of user interactions such as mouse, touch and pointer events.
https://github.com/pukhalski/tap/archive/master.zip
MIT License
527 stars 45 forks source link

preventDefault doesn't work in WP8 #16

Closed CheloXL closed 9 years ago

CheloXL commented 9 years ago

Simple test case: In desktop/iDevices, this is working fine. I get a "Tap event" and nothing else. But in WP8 (Tested Lumia 520) I get the "Tap event", but the event is not prevented and the link executes normally.

<!DOCTYPE html>
<html>
<head>
   <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
   <title>Test</title>
   <meta http-equiv="X-UA-Compatible" content="IE=edge">
   <script type="text/javascript" src="js/tap.js"></script>
</head>
<body>
    <div><a id="link" href="http://www.google.com">link to google</a></div>
    <div id="console" style="font-family: Consolas, Courier New, monospace"></div>
    <script type="text/javascript">
    document.getElementById('link').addEventListener('tap', function (e) {
        e.preventDefault();
        document.getElementById('console').innerHTML +="<p>Tap event</p>";
    });
    </script>
</body>
</html>
pukhalski commented 9 years ago

@CheloXL, thanks! Let me see what's going on there.

pukhalski commented 9 years ago

Hey @CheloXL, please try version 1.0.2 to see if it's fixed.

Thanks, @ezhlobo.

CheloXL commented 9 years ago

Yep. Now it works.. Nasty fix BTW...