﻿id	summary	reporter	owner	description	type	status	priority	milestone	component	version	resolution	keywords	cc
7067	about getIndex method  performance	campaign		"When the getIndex method is called, the getNext will be invoked by getIndex, if an element node contains too many text nodes, the getNext method will be called too many times, that will cause a performance problem. My suggest is using childNodes property, according to my test, using childNodes is nearly two times faster than calling getNext method. Here's my code snippet:

getIndex : function( normalized ) {
        var parent = this.getParent(),
                currentIndex = -1,
                node;
        if ( parent ) {

            for(var i=0,childs=parent.$.childNodes;node=childs[i];i++){
                if(node.nodeType == 1 || !(normalized && node.previousSibling && node.previousSibling.nodeType == baidu.editor.dom.NODE_TEXT))
                    currentIndex++;
                if(node == this.$)break;
            }
        }
        return currentIndex;
    },"	Bug	confirmed	Normal		Performance			HasPatch	
