X-Git-Url: https://jasonwoof.com/gitweb/?p=ckeditor.git;a=blobdiff_plain;f=_source%2Fplugins%2Fstylescombo%2Fplugin.js;h=fb44d5c2e472abb0038345d610cc7528e1d69c07;hp=f3ebfd52db785c126bd1a88f17d8ae0500a3f51d;hb=039a051ccf3901311661022a30afd60fc38130c9;hpb=c9fdde67e6384bd5a66adc2b3bba5c4ce9db56c7 diff --git a/_source/plugins/stylescombo/plugin.js b/_source/plugins/stylescombo/plugin.js index f3ebfd5..fb44d5c 100644 --- a/_source/plugins/stylescombo/plugin.js +++ b/_source/plugins/stylescombo/plugin.js @@ -26,7 +26,7 @@ For licensing, see LICENSE.html or http://ckeditor.com/license styleName; // Put all styles into an Array. - for ( var i = 0 ; i < stylesDefinitions.length ; i++ ) + for ( var i = 0, count = stylesDefinitions.length ; i < count ; i++ ) { var styleDefinition = stylesDefinitions[ i ]; @@ -71,7 +71,7 @@ For licensing, see LICENSE.html or http://ckeditor.com/license // Loop over the Array, adding all items to the // combo. var lastType; - for ( var i = 0 ; i < stylesList.length ; i++ ) + for ( var i = 0, count = stylesList.length ; i < count ; i++ ) { style = stylesList[ i ]; styleName = style._name; @@ -126,7 +126,7 @@ For licensing, see LICENSE.html or http://ckeditor.com/license elements = elementPath.elements; // For each element into the elements path. - for ( var i = 0, element ; i < elements.length ; i++ ) + for ( var i = 0, count = elements.length, element ; i < count ; i++ ) { element = elements[i]; @@ -154,9 +154,8 @@ For licensing, see LICENSE.html or http://ckeditor.com/license if ( CKEDITOR.env.ie || CKEDITOR.env.webkit ) editor.focus(); - var selection = editor.getSelection(); - - var element = selection.getSelectedElement(), + var selection = editor.getSelection(), + element = selection.getSelectedElement(), elementPath = new CKEDITOR.dom.elementPath( element || selection.getStartElement() ); var counter = [ 0, 0, 0, 0 ];