From 5cf87d502d4da692db2d93dc4228773935d61873 Mon Sep 17 00:00:00 2001 From: "glazman%netscape.com" Date: Wed, 16 Oct 2002 13:19:27 +0000 Subject: [PATCH] correct version of the file ; b=173319, r=brade, sr=peterv, a=rjesup --- editor/ui/composer/content/StructBarContextMenu.js | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/editor/ui/composer/content/StructBarContextMenu.js b/editor/ui/composer/content/StructBarContextMenu.js index 9b0fb9a8da4..1f9b7ab324a 100644 --- a/editor/ui/composer/content/StructBarContextMenu.js +++ b/editor/ui/composer/content/StructBarContextMenu.js @@ -78,6 +78,7 @@ function TableCellFilter(node) { case "td": case "th": + case "caption": return NodeFilter.FILTER_ACCEPT; break; default: @@ -96,8 +97,8 @@ function StructRemoveTag() var offset = 0; var childNodes = element.parentNode.childNodes; - while (childNodes.item(offset) != element) { - offset++; + while (childNodes[offset] != element) { + ++offset; } editor.beginTransaction(); @@ -114,10 +115,10 @@ function StructRemoveTag() NodeFilter.SHOW_ELEMENT, TableCellFilter, true); - var node = nodeIterator.nextNode(); + var node = nodeIterator.lastChild(); while (node) { MoveChildNodesAfterElement(editor, node, element, offset); - node = nodeIterator.nextNode(); + node = nodeIterator.previousSibling(); } } @@ -133,7 +134,7 @@ function MoveChildNodesAfterElement(editor, element, targetElement, targetOffset var childNodes = element.childNodes; var childNodesLength = childNodes.length; var i; - for (i = 0; i < childNodesLength; i++) { + for (i = childNodesLength - 1; i >= 0; i--) { var clone = childNodes.item(i).cloneNode(true); editor.insertNode(clone, targetElement.parentNode, targetOffset + 1); }