Opened 7 years ago

Last modified 6 years ago

#8967 assigned Bug

obvious bug in getEnclosedNode

Reported by: yiminghe Owned by: Jakub Ś
Priority: Normal Milestone:
Component: Core : Selection Version: 3.1.1
Keywords: HasPatch Cc:

Description

For example:

<div>

^
<bookmark/>
<span id='x'/>
<bookmark/>
^

getEnclosedNode should return span whose id is "x".

for detail see patch in attachement.

Attachments (2)

getEnclosedNode.patch (818 bytes) - added by yiminghe 7 years ago.
replacebycode2.html (793 bytes) - added by Jakub Ś 7 years ago.

Download all attachments as: .zip

Change History (7)

Changed 7 years ago by yiminghe

Attachment: getEnclosedNode.patch added

comment:1 Changed 7 years ago by Jakub Ś

Could you also provide a sample page which ilustrates this problem in code?

getEnclosedNode should return span whose id is "x".

Is actually no information. You haven't described the situation/steps to reproduce nor provided any sample page that would demonstrate the problem.

Problem may be obvious to you but not to other people reading it. Please bear this in mind when reporting tickets in the future.

Could you please provide an update.

comment:2 Changed 7 years ago by yiminghe

sorry, i thought garry will handle this bug. there is the test code.

steps:

  1. open the following page
<!doctype html>
<html>
<head>
<meta charset="utf-8"/>
<title>ckeditor source test</title>
</head>
<body>
    
    <div id='outer'>
        <span data-cke-bookmark='1'></span>
        <span id='x'></span>
        <span data-cke-bookmark='1'></span>
    </div>

    <script src="ckeditor_source.js">
    </script>
    <script type="text/javascript">        
        var range=new CKEDITOR.dom.range(document);
        var outer=CKEDITOR.dom.element.get(document.getElementById("outer"));
        range.setStart(outer,0);
        range.setEnd(outer,document.getElementById("outer").childNodes.length);
        
        var node=range.getEnclosedNode();
        
        alert(node&&node.$.id);
    </script>
</body>
</html>

expected result:

alert x

actual result:

alert null

Changed 7 years ago by Jakub Ś

Attachment: replacebycode2.html added

comment:3 Changed 7 years ago by Jakub Ś

Keywords: HasPatch added
Status: newconfirmed
Version: 3.6.4 (SVN - trunk)3.1.1

sorry, i thought garry will handle this bug

Most likely he will :) I've had in mind other users who will be having the same problem :)

Issue has been reproducible from CKEditor 3.1.1. I have attached sample to this ticket.

This patch seems to fix this particular issue. I'm not sure if it doesn't break code elsewhere. I will put it on review.

comment:4 Changed 7 years ago by Jakub Ś

Owner: set to Jakub Ś
Status: confirmedreview

comment:5 Changed 6 years ago by Frederico Caldeira Knabben

Status: reviewassigned

This patch needs to be transformed into a ticket branch on GitHub.

Note: See TracTickets for help on using tickets.
© 2003 – 2019 CKSource – Frederico Knabben. All rights reserved. | Terms of use | Privacy policy