This is a migrated thread and some comments may be shown as answers.

[Solved] Removing highlights in Firefox

1 Answer 105 Views
Editor
This is a migrated thread and some comments may be shown as answers.
Michael Pullella
Top achievements
Rank 1
Michael Pullella asked on 01 Mar 2010, 04:36 PM
Hi.

I have a Telerik Editor which contains a custom xhtml tag like the following:
<my:Comment   
    class=comment   
    commentValue="comment text for arrested">ARRESTED  
</my:Comment> MAN FOUND IN DITCH  

I have some javascript code which can remove the custom tag by doing the following:
        var oSel = editor.getSelectedElement();  
        if (confirm("Are you sure you wish to remove this comment?"))  
            oSel.outerHTML = oSel.outerText; 

The code basically replaces the selected element with just the text that was highlighted, so
ARRESTED MAN FOUND IN DITCH becomes
ARRESTED MAN FOUND IN DITCH
and the custom attributes associated with my:comment are also removed.

The code works properly in IE, however, Firefox doesn't recoginize the outerHTML or outerText properties.
What is the proper way to get such code to work in both browsers?

1 Answer, 1 is accepted

Sort by
0
Michael Pullella
Top achievements
Rank 1
answered on 02 Mar 2010, 01:17 PM

        var oSel = editor.getSelectedElement();  
        if (confirm("Are you sure you wish to remove this comment?"))  
            Telerik.Web.UI.Editor.Utils.removeNode(oSel);  
 
This solves the problem... Not sure if it is listed anywhere else.
Tags
Editor
Asked by
Michael Pullella
Top achievements
Rank 1
Answers by
Michael Pullella
Top achievements
Rank 1
Share this question
or