Skip to content

Instantly share code, notes, and snippets.

@donny-dont
Created November 16, 2012 18:45
Show Gist options
  • Save donny-dont/4089826 to your computer and use it in GitHub Desktop.
Save donny-dont/4089826 to your computer and use it in GitHub Desktop.
Drag and drop issue
import 'dart:html';
void main() {
query("#text")
..text = "Click me!";
// Works when compiled to JS
query("#container")
..on.drop.add(reverseText);
}
void reverseText(Event event) {
event.stopPropagation();
event.preventDefault();
var text = query("#text").text;
var buffer = new StringBuffer();
for (int i = text.length - 1; i >= 0; i--) {
buffer.add(text[i]);
}
query("#text").text = buffer.toString();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment