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.

Method or property IE 5.5 IE 6 IE 7 IE8b1 FF 2 FF 3 Saf 3.0 Win Saf 3.1 Win iPhone 3G Opera 9.26 Opera 9.51 Konqueror 3.5.7
On the window
No No Too many No Untestable No No
  • See below for Firefox 3.
On the document
No No Too many Yes Untestable No No
  • See below for Firefox 3.
On forms
Yes No Too many Yes Untestable No No
  • See below for Firefox 3.
On text inputs
Yes No Too many Yes Untestable No No
  • See below for Firefox 3.
Method or property IE 5.5 IE 6 IE 7 IE8b1 FF 2 FF 3 Saf 3.0 Win Saf 3.1 Win iPhone 3G Opera 9.26 Opera 9.51 Konqueror 3.5.7
On images

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

Yes No No Untestable 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 No Too many Yes Untestable No No
  • See below for Firefox 3.
Prevent default

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

Yes Untestable Yes Yes Untestable Untestable Untestable
Event bubbling

These events should bubble up.

Yes Untestable Yes Yes Untestable Untestable Untestable
Cancel bubble
Yes Untestable Yes Yes Untestable Untestable Untestable
Method or property IE 5.5 IE 6 IE 7 IE8b1 FF 2 FF 3 Saf 3.0 Win Saf 3.1 Win iPhone 3G Opera 9.26 Opera 9.51 Konqueror 3.5.7

Firefox bug

Firefox 3 has a lazy implementation: it 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, Firefox will fire a cut event, even though there's nothing to cut.

IE and Safari check if something is actually cut, copied or pasted before firing the events.

Related events

Event IE 5.5 IE 6 IE 7 IE8b1 FF 2 FF 3b5 Saf 3.0 Win Saf 3.1 Win Opera 9.26 Opera 9.5b Konqueror 3.5.7
beforecopy

Test page.

Yes No No Yes Untestable No No

I do not understand the real purpose of these events. However, when the user calls up a context menu that contains cut, copy and paste actions, beforecut, beforecopy and beforepaste all fire.

beforecut

Test page.

Yes No No Yes Untestable No No

See beforecopy.

beforepaste

Test page.

Yes No No Incomplete Untestable No No

See beforecopy.

  • Safari 3.1 does not fire this event before an actual paste action. It works fine on context menus.
Event IE 5.5 IE 6 IE 7 IE8b1 FF 2 FF 3b5 Saf 3.0 Win Saf 3.1 Win Opera 9.26 Opera 9.5b Konqueror 3.5.7