w3c / input-events

Input Events
https://w3c.github.io/input-events/
Other
23 stars 16 forks source link

[beforeinput] Rename drag&drop to deleteByDrag&insertFromDrop #19

Closed johanneswilm closed 7 years ago

johanneswilm commented 7 years ago

From @choniong on August 24, 2016 15:17

We should use the name deleteByDrag&insertFromDrop to make it clear that the event is only for DOM modification. (e.g. Preventing deleteByDrag won't stop the drag&drop process)

Background: Assume we all agree that InputEvent should only focus on DOM modification https://github.com/w3c/editing/issues/144#issuecomment-240892363, and we are renaming cut&paste to deleteByCut&insertFromPaste.

Copied from original issue: w3c/editing#147

johanneswilm commented 7 years ago

Right. What about the dataTransfer object? Should we keep that? In some ways it seems to be similar to clipboard operations.

johanneswilm commented 7 years ago

From @choniong on August 24, 2016 15:58

I would imagine we could have:

  1. dataTransfer=NULL for both deleteByDrag and deleteByCut, and
  2. dataTransfer=|data to insert| for insertFromDrop and insertFromPaste.

Does that sounds reasonable?

But for 2., should dataTransfer be the

  1. Raw data from clipboard/drag, or
  2. The fragment to be put on DOM?

e.g. The raw data could be <meta charset='utf-8'><h1 style="........">header</h1>, but the fragment being actually inserted could be just <h1>header</h1>.

I would vote for 1. Raw data since JS could put their own stuff, but this might not be consistence with beforeinput's definition?

johanneswilm commented 7 years ago

Hey, yes, it definitely needs to be 1 as the JS may decide to do something completely different with it and it should have access to the most "original" version of the data available.

Did you guys come to a conclusion on whether or not we can create both the dragend- and drop-based beforeinput events? If I recall correctly the plan was for the Chrome team to check their source code on whether it's viable to have both events.