cut, copy, paste

Test page.

Events overview page.

The cut, copy, and paste events fire when the user cuts, copies or pastes a text or image.

Test IE 5.5 IE 6 IE 7 IE8 IE9 IE10 pr2 FF 7.0 Win FF 6.1 Mac Saf 5.1 Win Saf 5.1 Mac Chrome 14 Win Chrome 13 Mac Opera 11.51 Win Opera 11.51 Mac
On the window
No Incomplete Yes Incomplete and lazy Incomplete Incomplete and lazy No
  • See below for the lazy implementation.
  • IE9/10, Safari, and Chrome only allows registration on the window if you use addEventListener().
On the document
No Incomplete Yes Lazy Yes Lazy No
  • See below for the lazy implementation.
  • IE9/10 only allows registration on the document if you use addEventListener().
On forms
Yes Yes Lazy Yes Lazy No
  • See below for the lazy implementation.
On text inputs
Yes Yes Lazy Yes Lazy No
  • See below for the lazy implementation.
Test IE 5.5 IE 6 IE 7 IE8 IE9 IE10 pr2 FF 7.0 Win FF 6.1 Mac Saf 5.1 Win Saf 5.1 Mac Chrome 14 Win Chrome 13 Mac Opera 11.51 Win Opera 11.51 Mac
On images

When you go to the context menu and select 'Copy image' or a similar command.

Yes No No No No
On any element

In general only the copy event should be available, since it's not possible to cut or paste text from or to, say, a paragraph.

Yes Yes Lazy Yes Lazy No
  • See below for the lazy implementation.
Prevent default

The point of these events: can you prevent a cut, copy or paste action from taking place?

Yes Yes Almost Yes Untestable
  • In Safari the default of the copy event can be prevented, but the clipboard is emptied, while it should retain the previous value, as it does in IE and Firefox.
Event bubbling

These events should bubble up.

Yes Yes Yes Yes Untestable
Cancel bubble
Yes Yes Yes Yes Untestable
Test IE 5.5 IE 6 IE 7 IE8 IE9 IE10 pr2 FF 7.0 Win FF 6.1 Mac Saf 5.1 Win Saf 5.1 Mac Chrome 14 Win Chrome 13 Mac Opera 11.51 Win Opera 11.51 Mac

Lazy implementation

Lazy implementation: the browser fires these events whenever the user presses the Cut, Copy, or Paste shortcut keys, whether that action makes sense in a given context or not.

For instance, when you press [Ctrl | Cmd]+X while the focus is nowhere in particular and you have not selected any text, some browsers will fire a cut event, even though there's nothing to cut.

This is a very odd bug, in that it’s an old one in Firefox but solved in FF4, but new in Safari and Chrome. Safari 3 and Chrome 1 did not have this bug and implemented the events correctly, but newer versions do have the bug.