I’m using following for loop in one my javascript functions to create a data row in my application.
for (var j = 0, length = contentsArray.length; j < length; j++) {
//get the control for the node at this index
contentControl = contentControlDef.getControlForObjectAtContainerIndex(contentsArray[j], j);
//repopulate node; call overwriteDomNode(instanceDom, contentsArray, index);
contentControl.overwriteDomNode(contentsDom.childNodes[j], contentsArray, j);
}
In this case, contentsDom.childNodes is an array of [object HtmlDivElements] in both IE and FF. But in Chrome, that’s different. It has the same amount of elements in the array. But it has both [object text] and [object HtmlDivElement] one after another. It should have all the HtmlDivElements. Does anyone know why is this happening in chrome?
Change the code to:
childNodesreturns also the text nodes. Usechildrenif you don’t need the text nodes.