Opened 11 years ago

Closed 11 years ago

#3267 closed Bug (fixed)

Exception in selection plugin when loading hidden editor

Reported by: Josh Nisly Owned by:
Priority: Normal Milestone: CKEditor 3.0
Component: General Version: 3.0 Beta
Keywords: Confirmed Review+ Cc:

Description

If CKEditor is loaded in a hidden element, getRanges() in the selection plugin throws a JavaScript exception, since getNative returns null, and the return value isn't checked. Adding

if (sel === null)
   return [];

on line 447 of selection/plugin.js fixes the problem for me.

This problem can be duplicated in replace-by-class by adding "display: none" to the containing <p> element's style.

Attachments (1)

3267.patch (868 bytes) - added by Artur Formella 11 years ago.

Download all attachments as: .zip

Change History (5)

comment:1 Changed 11 years ago by Artur Formella

Keywords: Confirmed added
Milestone: CKEditor 3.0

comment:2 Changed 11 years ago by Artur Formella

Keywords: Review? added

Changed 11 years ago by Artur Formella

Attachment: 3267.patch added

comment:3 Changed 11 years ago by Frederico Caldeira Knabben

Keywords: Review+ added; Review? removed

To check objects, it's not necessary to compare then with null. You did it well in line 580, but used a different style in line 525. Also, at that point you can safely check for "nativeRange", instead of "sel". In this way we make two checks in a single move.

So, for the addition at line 525:

if ( !nativeRange )
	return [];

Please make that change and go ahead committing it.

comment:4 Changed 11 years ago by Artur Formella

Resolution: fixed
Status: newclosed

Fixed with [3346]

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