diff --git a/main/inc/lib/fckeditor/editor/_source/internals/fckselection_gecko.js b/main/inc/lib/fckeditor/editor/_source/internals/fckselection_gecko.js index 5dad5210f9..3a8c5840f1 100755 --- a/main/inc/lib/fckeditor/editor/_source/internals/fckselection_gecko.js +++ b/main/inc/lib/fckeditor/editor/_source/internals/fckselection_gecko.js @@ -183,17 +183,20 @@ FCKSelection.MoveToAncestorNode = function( nodeTagName ) var oNode ; var oContainer = this.GetSelectedElement() ; - if ( ! oContainer ) - oContainer = this.GetSelection().getRangeAt(0).startContainer ; - - while ( oContainer ) - { + if ( ! oContainer ) { + var selection = this.GetSelection(); + if (selection.rangeCount) { + oContainer = selection.getRangeAt(0).startContainer ; + } + } + + while ( oContainer ) { if ( oContainer.nodeName.IEquals( nodeTagName ) ) return oContainer ; oContainer = oContainer.parentNode ; } - return null ; + return null; } FCKSelection.Delete = function()