2 ms·
I guess I'm surprised that so much hand-holding is required. Ideally, web pages don't even have to think about mouse events (which would also pave the way for
by makecheck 17y ago
I guess I'm surprised that so much hand-holding is required. Ideally, web pages don't even have to think about mouse events (which would also pave the way for concepts like assisted-devices that let drags be achieved without a mouse).
I suppose my ideal setup would be to have most events handled entirely by the web browser. The page then only has to define the corner cases of interest, namely:
- A single JavaScript event for drags, to retrieve the promised data.
- A single JavaScript event for drops, where one of the arguments is the specific type of data (pulled from the property of the source).
- A single element property to indicate that the entire element is draggable. This property's value is a "type" (perhaps based on Apple's UTIs, e.g. "public.jpeg" or "public.xml") to indicate what kind of data is represented, e.g. <div id="abc" dragtypes="public.xml" ondrag="...">...</div>.
- An element property to indicate that the entire element accepts drops of one or more types, e.g. <div id="foo" droptypes="public.jpeg public.png" ondrop="...">...</div>.
- New CSS classes, similar to :hover, to define presentation for the drag-and-drop cases, such as ":drag-source", ":drop-pending" and ":drop-disallowed". This allows elements to automatically change appearance, without any JavaScript at all, as drags occur.
Not having implemented a web browser, I don't understand all the nuances, but I'm not sure why it can't be as simple as the above. I know that the above is what I would want to have.