BUGFIX Fixed sortWidgets() function in WidgetAreaEditor not working because it was picking up comment nodes

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/branches/2.3@66828 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Sean Harvey 2008-11-27 05:27:18 +00:00 committed by Sam Minnee
parent 13d0f09717
commit 43058e137c

View File

@ -103,17 +103,23 @@ WidgetAreaEditor.prototype = {
// Order the sort by the order the widgets are in the list
var usedWidgets = $('WidgetAreaEditor_usedWidgets');
if (usedWidgets) {
if(usedWidgets) {
widgets = usedWidgets.childNodes;
for( i = 0; div = widgets[i]; i++ ) {
for(i = 0; i < widgets.length; i++) {
var div = widgets[i];
if(div.nodeName != '#comment') {
var fields = div.getElementsByTagName('input');
for( j = 0; field = fields.item(j); j++ ) {
if( field.name == div.id + '[Sort]' ) {
for(j = 0; field = fields.item(j); j++) {
if(field.name == div.id + '[Sort]') {
field.value = i;
}
}
}
}
}
},