Re: (editor1doc.selection).type does not work in Firefox?

  •  11-12-2007, 6:36 PM

    Re: (editor1doc.selection).type does not work in Firefox?

    Adam, The first clause of the IF statement just drops out of the function without proceeding, but if you comment that out and start with the window.getSelection clause it seems to work fine, at least for the situations we are concerned with.   Thanks!

    function getSelectedHTML(){
          var rng=null,html="";

          //if (document.selection && document.selection.createRange){
          //  rng=editdoc.selection.createRange();
          //  html=rng.htmlText||"";
          //}else
     if (window.getSelection){
            rng=editwin.getSelection();
            if (rng.rangeCount > 0 && window.XMLSerializer){
              rng=rng.getRangeAt(0);
              html=new XMLSerializer().serializeToString(rng.cloneContents());
            }
          }
          return html;
        }
View Complete Thread