From 3faf06fe0d90ce957708dc159b2ad41e4836d9a9 Mon Sep 17 00:00:00 2001 From: Kieran Tully Date: Sun, 26 Mar 2017 21:52:32 +0100 Subject: [PATCH 01/19] Make existing test description consistent --- test/iframe.html | 2 +- test/index.html | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/test/iframe.html b/test/iframe.html index c24e1e5..7f490cc 100644 --- a/test/iframe.html +++ b/test/iframe.html @@ -1,7 +1,7 @@

(This is a form inside of an iframe.)

- + diff --git a/test/index.html b/test/index.html index 95c2f99..ee1f0e3 100644 --- a/test/index.html +++ b/test/index.html @@ -8,7 +8,7 @@ time a page like this is created, a kitten is killed.

(This is a form in the root document.)

-

Go ahead, try to paste:

+

Go ahead, try to copy or paste:

From 0ce338e3486e8b91c5f050fd711a696d927e3f7f Mon Sep 17 00:00:00 2001 From: Kieran Tully Date: Sun, 11 Mar 2018 00:21:12 +0000 Subject: [PATCH 02/19] Add test case for cut blocking --- test/iframe.html | 2 +- test/index.html | 4 ++-- test/script.js | 14 +++++++++----- 3 files changed, 12 insertions(+), 8 deletions(-) diff --git a/test/iframe.html b/test/iframe.html index 7f490cc..fc802c1 100644 --- a/test/iframe.html +++ b/test/iframe.html @@ -2,7 +2,7 @@

(This is a form inside of an iframe.)

- + diff --git a/test/index.html b/test/index.html index ee1f0e3..23bdb95 100644 --- a/test/index.html +++ b/test/index.html @@ -8,8 +8,8 @@ time a page like this is created, a kitten is killed.

(This is a form in the root document.)

-

Go ahead, try to copy or paste:

- +

Go ahead, try to cut, copy or paste:

+
diff --git a/test/script.js b/test/script.js index cadbdd9..ce1548d 100644 --- a/test/script.js +++ b/test/script.js @@ -1,7 +1,11 @@ window.onload = function(){ - var preventCopyAndPaste = function(e){ e.preventDefault(); } - document.getElementById('property').onpaste = preventCopyAndPaste; - document.getElementById('property').oncopy = preventCopyAndPaste; - document.getElementById('listener').addEventListener('copy', preventCopyAndPaste, false); - document.getElementById('listener').addEventListener('paste', preventCopyAndPaste, false); + var prevent = function(e){ e.preventDefault(); } + + document.getElementById('property').onpaste = prevent; + document.getElementById('property').oncopy = prevent; + document.getElementById('property').oncut = prevent; + + document.getElementById('listener').addEventListener('copy', prevent, false); + document.getElementById('listener').addEventListener('paste', prevent, false); + document.getElementById('listener').addEventListener('cut', prevent, false); }; From 700ed4c7e3c7b7ff55da018a33138f197bb789f9 Mon Sep 17 00:00:00 2001 From: Kieran Tully Date: Sun, 11 Mar 2018 00:22:18 +0000 Subject: [PATCH 03/19] Remove unmatched id from