X-Git-Url: https://jasonwoof.com/gitweb/?p=ckeditor.git;a=blobdiff_plain;f=_source%2Fcore%2Fdom%2Fnode.js;h=a4188dcd17b81c685faa035588c8797fef13145e;hp=6f25ec1f21feceeb130a899cba5ba0f922e6c017;hb=c6e377a02b54abc07129d72b632763c727476a15;hpb=941b0a9ba4e673e292510d80a5a86806994b8ea6 diff --git a/_source/core/dom/node.js b/_source/core/dom/node.js index 6f25ec1..a4188dc 100644 --- a/_source/core/dom/node.js +++ b/_source/core/dom/node.js @@ -194,27 +194,30 @@ CKEDITOR.tools.extend( CKEDITOR.dom.node.prototype, var parentNode = node.parentNode; var currentIndex = -1; - for ( var i = 0 ; i < parentNode.childNodes.length ; i++ ) + if ( parentNode ) { - var candidate = parentNode.childNodes[i]; - - if ( normalized && - candidate.nodeType == 3 && - candidate.previousSibling && - candidate.previousSibling.nodeType == 3 ) + for ( var i = 0 ; i < parentNode.childNodes.length ; i++ ) { - continue; - } + var candidate = parentNode.childNodes[i]; + + if ( normalized && + candidate.nodeType == 3 && + candidate.previousSibling && + candidate.previousSibling.nodeType == 3 ) + { + continue; + } - currentIndex++; + currentIndex++; - if ( candidate == node ) - break; - } + if ( candidate == node ) + break; + } - address.unshift( currentIndex ); + address.unshift( currentIndex ); + } - node = node.parentNode; + node = parentNode; } return address; @@ -232,7 +235,6 @@ CKEDITOR.tools.extend( CKEDITOR.dom.node.prototype, var document = new CKEDITOR.dom.document( this.$.ownerDocument || this.$.parentNode.ownerDocument ); return ( - /** @ignore */ this.getDocument = function() { return document;