Created
November 16, 2012 18:45
-
-
Save donny-dont/4089826 to your computer and use it in GitHub Desktop.
Drag and drop issue
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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