changeset 48:f817d2a5cc0a

DnD: Fix a JS error that occured when disabling the RTE
author Franck Deroche <defr@ows.fr>
date Mon, 19 Apr 2010 10:35:02 +0000
parents cbfe386cb51b
children af6627970bc4
files js/jquery.draganddrop.js
diffstat 1 files changed, 5 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/js/jquery.draganddrop.js	Mon Feb 15 14:08:04 2010 +0000
+++ b/js/jquery.draganddrop.js	Mon Apr 19 10:35:02 2010 +0000
@@ -128,6 +128,11 @@
     $(targets).filter('iframe').each(function() {
       var target = this; 
       var t = setInterval(function() {              
+        var ifr = $(target)[0];
+        // Check that jQuery .contents() can work, and return early otherwise.
+        if (!ifr.contentDocument && !ifr.contentWindow) {
+          return;
+        }
         $('img:not(.'+ opt.droppedClass +')', $(target).contents()).each(function() {
           opt.processIframeDrop.call(target, this, opt.idSelector);
           var data = {'drop': this, 'representation_id': opt.idSelector(this)};