Skip to content

Instantly share code, notes, and snippets.

@iggymacd
Created March 9, 2012 17:23
Show Gist options
  • Save iggymacd/2007633 to your computer and use it in GitHub Desktop.
Save iggymacd/2007633 to your computer and use it in GitHub Desktop.
Dart sample click simulation
#import("dart:html");
void main() {
document.query('#button').on.click.add( (e)
{
document.query('#result').innerHTML="clicked!";
});
MouseEvent e = new MouseEvent( 'click', window, 0,0,0,0,0,0,
canBubble:true, cancelable:true,
relatedTarget:document.query("#button"));
document.query("#button").on.click.dispatch(e);
}
<html>
<head>
<title>playground</title>
</head>
<body>
<h1>playground</h1>
<div id="button">Click me!</div>
<div id="result"></div>
<script type="application/dart" src="playground.dart"></script>
<script src=
"http://dart.googlecode.com/svn/branches/bleeding_edge/dart/client/dart.js">
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment