diff --git a/build.json b/build.json index e1f86bd..607e372 100644 --- a/build.json +++ b/build.json @@ -41,5 +41,6 @@ "src/wrappers/Selection.js", "src/wrappers/Document.js", "src/wrappers/Window.js", + "src/wrappers/DataTransfer.js", "src/wrappers/override-constructors.js" ] diff --git a/shadowdom.js b/shadowdom.js index 4c75063..e666234 100644 --- a/shadowdom.js +++ b/shadowdom.js @@ -57,6 +57,7 @@ 'src/wrappers/Selection.js', 'src/wrappers/Document.js', 'src/wrappers/Window.js', + 'src/wrappers/DataTransfer.js', 'src/wrappers/override-constructors.js' ].forEach(function(src) { document.write(''); diff --git a/src/wrappers/DataTransfer.js b/src/wrappers/DataTransfer.js new file mode 100644 index 0000000..84d6ad2 --- /dev/null +++ b/src/wrappers/DataTransfer.js @@ -0,0 +1,24 @@ +/** + * Copyright 2014 The Polymer Authors. All rights reserved. + * Use of this source code is goverened by a BSD-style + * license that can be found in the LICENSE file. + */ + +(function(scope) { + 'use strict'; + + var unwrap = scope.unwrap; + + // DataTransfer (Clipboard in old Blink/WebKit) has a single method that + // requires wrapping. Since it is only a method we do not need a real wrapper, + // we can just override the method. + + var OriginalDataTransfer = window.DataTransfer || window.Clipboard; + var OriginalDataTransferSetDragImage = + OriginalDataTransfer.prototype.setDragImage; + + OriginalDataTransfer.prototype.setDragImage = function(image, x, y) { + OriginalDataTransferSetDragImage.call(this, unwrap(image), x, y); + }; + +})(window.ShadowDOMPolyfill);