Jump to content

Drag'N'Drop API - opinions, usage, and how it works behind the scenes


TheRiddler

Recommended Posts

I just started learning this functionality a few days ago.

 

What does everybody think of the native drag'n'drop API in HTML 5? Good, bad, ugly? I came across one article where a developer lambasted the API to death. But it's quite old also:

 

http://www.quirksmode.org/blog/archives/2009/09/the_html5_drag.html

 

My usage and experimentation has actually been limited within the scope of the browser itself, i.e., moving elements, basically images, from one container element to another. I may experiment with using it between the OS and browser as I become more familiar with it. I am guessing this API was made more for interactions between the browser and the host OS more so than just moving things inside the DOM. Am I right on that?

 

What's everybody's opinion of this API in it's "current" state. Does it bring much to the table over anything jQuery can do?

 

Also, I wonder if anybody knows how the Chrome browser keeps track of a drag'n'drop operation from beginning to end? I've tried handling a "drop" event handler without cancelling an "ondragenter" event. But it just won't work. If I don't cancel the "ondragenter" or "ondragover" event then my "ondrop" event handler never get's called. I've tried finding the actual source code for this API but it's a minefield of alphabet soup. I don't know if it's in Chromium code or WebKit or WebKit 2 code or Blink. And when I do get close the number of folders one can dive into is completely overwhelming.

Edited by TheRiddler
Link to comment
Share on other sites

The article is back from 2009, so things may have changed since then.

 

I haven't actually used the API, so I can't say. The older approach using mousedown, mousemove and mouseup is very reliable, at least.

Link to comment
Share on other sites

I don't think it matters whether it is or blink or webkit. They both support the API. Those are rendering engines, and I would not expect the API core classes to be there. The way Chrome is organized, I would expect it to be in either the user interface modules, or the browser engine modules. The browser engine is the more likely candidate because those modules sit between the UI and the rendering engine; and the browser engine is the key part of interfacing for event handlers. However depending on how primitive a level it is hooking into the O/S it might be in the UI backend which is the piece that interacts with the OS and .

 

A lot of the Chrome documentation is pretty sloppy and the last estimate I saw of its size was something on the order of 7 or 8 million lines of code so outside of the core development teams I doubt there are many who can actually locate specific pieces of code they are working on.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...