locked
textRange.pasteHTML() quietly not doing anything; how to diagnose? RRS feed

  • Question

  • User1562156107 posted

    Hi...

    We use the Cute wysiwyg on our site, and we've suddenly sprouted a problem with how its Paste function works when called one way but not another.  Below is how they do paste.  Basically, they add a little marker to what you want to paste, call pasteHTML(), then verify things worked by snipping out their marker.  It's the last bit that's blowing up now in some circumstances.

     // Javascript/comment in the beginning of the HTML will be preserved.
     val = '<span id="__temp_span__" style="display:none;">temp_span</span>' + val ;
     var r=editdoc.selection.createRange();
     r.select();
     editdoc.parentWindow.focus(); 
      r.pasteHTML(val);
      editdoc.getElementById("__temp_span__").removeNode(true); // BOOOM!

    My problem is that I have yet to identify what the circumstance is that's causing the failure.

    I've looked to see what editdoc.parentWindow.document.activeElement is when it's working and when it's not, and in both cases it appears to be the <BODY> element of the iframe is working in.

    Is there any way to figure out why pasteHTML() chooses not to actually paste something?

    thanks

    Mark

     

    Monday, May 23, 2011 4:11 PM

All replies