This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.
"Neither Firefox nor Chrome let you clear the contents of the clipboard by calling event.clipboardData.clearData(). IMO, we should update the spec to reflect this." http://lists.w3.org/Archives/Public/public-webapps/2013JulSep/0064.html
Why shouldn't `clearData` be allowed to clear the clipboard during a synchronous flow of a copy event? This is vitally important in making sensible data sets for copying. Without it, things can get VERY weird for the user. For example: 1. The user's clipboard holds existing HTML data in the HTML clipboard segment. 2. The user comes to your web application and invokes your copy functionality. 3. Your copy only adds plain text data to the text clipboard segment but cannot clear the other segments (e.g. HTML). 4. The user opens a rich text editor (e.g. Microsoft Word). 5. The user tries to paste the text they just got from your web app into Word. 6. The pasted content would be the previously existing HTML data. Not good!
I suppose the implementation should clear the clipboard (in that sense of "clear") automatically, i.e. ensure that current clipboard contents are *replaced* entirely by the new content. I would certainly not push this responsibility onto script authors - that would let them create an endless amount of apparently random and hard to understand bugs..
I agree with that suggestion.
reported bug 23547 just in case the spec isn't clear (no pun intended) enough
Keeping this functionality is probably a good idea, however the way it currently works seems a bit dodgy - the main use case for this seems to be stuff like apps shutting down and desiring to clear the clipboard because they wrote a lot of content or something semi-secret there. For such use cases, it doesn't make sense to expose the functionality only inside events.. :-/ As written and summarized this bug is a wontfix though. Also, I'm not sure if being able to delete specific types from the clipboard is really necessary. We'd be able to simplify things if we dropped that feature..
**shrugs** None of my personal use cases require me to use `clearData` whatsoever, though I'm fairly certain there are others who do need it.