02-08-2012 03:44 PM
In Ripple, on many of my clickable things, I am getting two events -- an "Object" that looks like an event, and a "MouseEvent". Which is the correct one to be receiving?
In other operating systems, I get one or the other, but not both.
02-14-2012 06:35 PM
Hi there,
Could you provide a small HTML sample page that produces this?
Erik Oros
BlackBerry Development Advisor
02-15-2012 04:19 AM
<body onclick="doSomething();">
<script>function doSomething(inSender, inEvent) { console.log(inEvent); }</script>
</body>
happens nearly all the time in Ripple, and occasionally on device emulator. Lacking an answer to this question, I went ahead and ignored the one that wasn't a MouseEvent, and that seems to work pretty well at least in emulator.
02-15-2012 12:45 PM
When I test this, I am actually getting inSender and inEvent logged as undefined which makes sense as the onclick is explicitly calling doSomething() without any parameters being passed in.
When I do something like the following though, note that only one paramater is being passed in (assigned to inSender) that is a MouseEvent. However inEvent remains undefined as expected.
<!DOCTYPE html>
<html>
<head>
<title>Sandbox</title>
<script>function doSomething(inSender, inEvent) { console.log(inSender); console.log(inEvent); }</script>
</head>
<body>
<div id="foo">bar</div>
<script type="text/javascript">
document.getElementById("foo").onclick = doSomething;
</script>
</body>
</html>
The difference being that the onclick method is being assigned and called in a default manner (as opposed to us providing the explicit JavaScript for onclick.)
Just to make sure, are you using the latest version of the standalone Ripple software? (0.9.1 Beta, not the Chrome plug-in.)
Erik Oros
BlackBerry Development Advisor