The Draggable List: a Benchmark Widget for Web Languages
Here's a nicely-defined problem that comes up repeatedly in web development, and serves as a simple example of some of the problems that come up in programming client-side web applications. We can measure web languages by how well they can express a solution to this.
The goal is to create a "draggable list." Here the user is shown a list of things—for example, to-do items—and has the opportunity to re-arrange them by dragging & dropping. While the user is dragging, the UI must indicate where the dragged item would be placed if the user let up the mouse at that moment. When the user lets go of the mouse button, the list should, of course, be permanently reordered on the page; afterwards the user can do more drag actions, or not.
The behavior should be abstracted from the concrete HTML/CSS representation so that the behavior is reusable with respect to a wide variety of visual treatments.
A side condition is that it should be easy to get the reordered list data *itself*, not by scraping the DOM tree. In this case it's easy, but the approach ought to extend directly to more complex widgets with more complex models.
How to visually indicate where the item would be dropped should be up to the coder. It's worth noting that there are generally two good ways of doing it. One way is to leave all the existing items in place but to display a solid line between the two elements where this one would be inserted. Only after the user lets go are any of the other elements moved on the screen. The other approach is to move around a representation of the dragged element—in this case, the other elements are displaced while you drag. This approach is taken in the best-known ready-made example of the Draggable List (if anyway knows of other good examples, please let me know).
Looking at the source of that implementation, JavaScript performs poorly on the Draggable List benchmark problem. Any other contenders?
UPDATE: Another implementation, very appealing to the user. But, appealing to the programmer?
Comments
cool your link appear in reddit.com
Posted by: red | November 8, 2005 10:37 PM
Hi, Nice!
Posted by: Anonymous | May 27, 2006 1:58 PM
Outstanding quest there. What happened after? Good
luck!
Posted by: john thomas financial | October 29, 2012 5:11 AM