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

Editor getRange returns wrong range in Internet Explorer

2 Answers 111 Views
Editor
This is a migrated thread and some comments may be shown as answers.
Ruairi
Top achievements
Rank 1
Ruairi asked on 03 Oct 2016, 02:36 PM

I'm using editor.getRange() function from the Editor Select event to get the current range of an element selected in the Editor.

In Chrome the getRange() function returns the range I would expect.

However in Internet Explorer the getRange() function return the wrong range. 

Why does the same method return 2 different items? The html I'm using in the the editor is as below.

 

<p style="text-align:left;"><strong></strong>Test the range of the following field <span class="dfw-IsMergeField dfw-EditorMergeField" contenteditable="false" data-iscollection="false" data-name="ApplicantAddress" data-path="Mallons.DomainFire.Models.MergeTemplates.FireCertTemplate.ApplicantAddress" id="mergeFieldButton" title="Applicant Address">ApplicantAddress</span> in Chrome and Explorer</p>
<p> </p>

2 Answers, 1 is accepted

Sort by
0
Accepted
Rumen
Telerik team
answered on 04 Oct 2016, 02:07 PM
Hi Tyler,

I tested the getRange() method under IE11, Firefox and Chrome and I was unable to reproduce different results. Can you please take a look at the following video http://screencast.com/t/pLDe8tUhC and let me know how to reproduce the issue on my end?

Here is my Dojo sample: http://dojo.telerik.com/@RumenJ/urAcE.

Best regards,
Rumen
Telerik by Progress
 
Get started with Kendo UI in days. Online training courses help you quickly implement components into your apps.
 
0
Ruairi
Top achievements
Rank 1
answered on 04 Oct 2016, 03:14 PM

I've found the problem and its not Kendo UI's fault. Its to do with Internet Explorer and not supporting some of the selected 'range' properties. 

var editor = e.sender;
var range = editor.getRange();
var startNode = range.startContainer; //This works in IE
var parentElement = startNode.parentElement; //This is NOT supported in IE

 

Ive added a fiddler here showing this. Run it in chrome and you get 2 messages but only 1 in Internet Explorer.

http://dojo.telerik.com/@Mallon/ekiTu

 

 

Tags
Editor
Asked by
Ruairi
Top achievements
Rank 1
Answers by
Rumen
Telerik team
Ruairi
Top achievements
Rank 1
Share this question
or