This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 23232 - clipboardData.clearData() should not clear clipboard
Summary: clipboardData.clearData() should not clear clipboard
Status: RESOLVED WONTFIX
Alias: None
Product: WebAppsWG
Classification: Unclassified
Component: HISTORICAL - Clipboard API and events (show other bugs)
Version: unspecified
Hardware: PC Linux
: P2 normal
Target Milestone: ---
Assignee: Hallvord R. M. Steen
QA Contact: public-webapps-bugzilla
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-09-13 08:45 UTC by Hallvord R. M. Steen
Modified: 2014-01-23 23:24 UTC (History)
2 users (show)

See Also:


Attachments

Description Hallvord R. M. Steen 2013-09-13 08:45:31 UTC
"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
Comment 1 James M. Greene 2013-10-17 04:32:25 UTC
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!
Comment 2 Hallvord R. M. Steen 2013-10-17 09:07:53 UTC
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..
Comment 3 James M. Greene 2013-10-17 10:45:40 UTC
I agree with that suggestion.
Comment 4 Hallvord R. M. Steen 2013-10-17 12:50:20 UTC
reported bug 23547 just in case the spec isn't clear (no pun intended) enough
Comment 5 Hallvord R. M. Steen 2014-01-21 01:15:03 UTC
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..
Comment 6 James M. Greene 2014-01-23 23:24:21 UTC
**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.