Though, it is interesting that in the earlier versions of HTML, this element was not included. Drag and drop functionality in HTML5 can now be used in making diagrams, managing files and just about every other standard drag and drop functionality. In HTML5 this native drag and drop functionality is not limited to the mouse events but rather it is more advanced when it is integrated in managing files on the developer’s end. Drag and drop element works differently in HTML5.
There are many drawbacks and short comings in using this functionality in other development and code versions. A notable drawback is that ad hoc drag and drop functionality cannot be mixed with other content on the same web page unless both commands are integrated into your code first. This random mixing will lead to havoc on the web page. Another, major drawback of ad hoc drag and drop is that it does not allow the user to use it on the desktop and does not work in Windows. In HTML5 each of these problems have been taken care of providing a problem free framework for drag and drop API as well as faster web apps. HTML5 drag and drop functionality resembles the Java API and MFC. Developers who have already worked with these APIs can easily understand the drag and drop API in HTML5.
Draggable=’true’
Dragging an object in HTML5 can be done following simple and easy steps. Draggable ‘true’ attribute is used to drag the required content. Just about everything is drag able in HTML5, this includes links images and files. Dragging an image attribute will look like this
When we set an image or link as drag-able, we have to put its URL in the code to allow this feature. The text content can be integrated in to the code itself. But the links, images are by default and can be dragged in HTML5. To make other elements drag-able in HTML5 through the same ‘true’ attribute. But the one thing to be done is adding a listener in the ‘dragstart’. The following example explains how to include other data to be dragged.
< div draggable= ”true”ondragstart=“event.dataTransfer.setData(‘text/plain’’, ‘ This is the content that is being dragged”>
This is the content that is being dragged .
In the above example to make the element drag able ‘true’ attribute is used. If you want to make these elements not drag-able then ‘false’ value is used to disable the drag function.
But this is not the case with the XUL elements. They are all drag-able and there is no need to use drag-able attribute.