JasonWoof Got questions, comments, patches, etc.? Contact Jason Woofenden
vanilla ckeditor-3.4.2
[ckeditor.git] / _source / plugins / removeformat / plugin.js
index d54bfb3..86544ab 100644 (file)
@@ -35,9 +35,11 @@ CKEDITOR.plugins.removeformat =
                                        ( editor._.removeAttributes = editor.config.removeFormatAttributes.split( ',' ) );\r
 \r
                                var filter = CKEDITOR.plugins.removeformat.filter;\r
-                               var ranges = editor.getSelection().getRanges();\r
+                               var ranges = editor.getSelection().getRanges( 1 ),\r
+                                       iterator = ranges.createIterator(),\r
+                                       range;\r
 \r
-                               for ( var i = 0, range ; range = ranges[ i ] ; i++ )\r
+                               while ( ( range = iterator.getNextRange() ) )\r
                                {\r
                                        if ( range.collapsed )\r
                                                continue;\r
@@ -48,8 +50,8 @@ CKEDITOR.plugins.removeformat =
                                        var bookmark = range.createBookmark();\r
 \r
                                        // The style will be applied within the bookmark boundaries.\r
-                                       var startNode   = bookmark.startNode;\r
-                                       var endNode             = bookmark.endNode;\r
+                                       var startNode   = bookmark.startNode,\r
+                                               endNode         = bookmark.endNode;\r
 \r
                                        // We need to check the selection boundaries (bookmark spans) to break\r
                                        // the code in a way that we can properly remove partially selected nodes.\r
@@ -64,8 +66,8 @@ CKEDITOR.plugins.removeformat =
                                        var breakParent = function( node )\r
                                        {\r
                                                // Let's start checking the start boundary.\r
-                                               var path = new CKEDITOR.dom.elementPath( node );\r
-                                               var pathElements = path.elements;\r
+                                               var path = new CKEDITOR.dom.elementPath( node ),\r
+                                                       pathElements = path.elements;\r
 \r
                                                for ( var i = 1, pathElement ; pathElement = pathElements[ i ] ; i++ )\r
                                                {\r
@@ -101,7 +103,7 @@ CKEDITOR.plugins.removeformat =
                                                {\r
                                                        // Remove elements nodes that match with this style rules.\r
                                                        if ( tagsRegex.test( currentNode.getName() ) )\r
-                                                               currentNode.remove( true );\r
+                                                               currentNode.remove( 1 );\r
                                                        else\r
                                                        {\r
                                                                currentNode.removeAttributes( removeAttributes );\r