X-Git-Url: https://jasonwoof.com/gitweb/?p=peach-html5-editor.git;a=blobdiff_plain;f=editor.js;fp=editor.js;h=72e850670bc2b307ba81629cd02634ce1710556d;hp=977ca9e5d3d3da0fa79fa1baf2f313bd86aac4bc;hb=4ec99c39c0180df2d6380cb11c86b6e5f13292cf;hpb=9b392e3bbe45db8c3e235f0809d0555afa0f4ce8 diff --git a/editor.js b/editor.js index 977ca9e..72e8506 100644 --- a/editor.js +++ b/editor.js @@ -429,7 +429,7 @@ function instantiate_tree (tree, parent) { case 'tag': if (c.name === 'script' || c.name === 'object' || c.name === 'iframe' || c.name === 'link') { // TODO put placeholders instead - remove.unshift(i) + remove.unshift(i) // add to beginning so they are removed last first continue } // TODO create in correct namespace @@ -450,13 +450,11 @@ function instantiate_tree (tree, parent) { } } } - results = [] + // these are in reverse order so we remove highest indexes first for (i = 0; i < remove.length; i++) { - // FIXME this deletes the wrong node when siblings are removed index = remove[i] - results.push(tree.splice(index, 1)) + tree.splice(index, 1) } - return results } function traverse_tree (tree, cb) {