From 35793751e726942cc668ac3c314a62aac3ba5018 Mon Sep 17 00:00:00 2001 From: Casey Foster Date: Tue, 12 Mar 2013 14:58:23 -0500 Subject: [PATCH 1/3] Use for loop to iterate over array, check existance --- plugins/filebrowser/plugin.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/plugins/filebrowser/plugin.js b/plugins/filebrowser/plugin.js index 3b1f564ee68..2566637905f 100644 --- a/plugins/filebrowser/plugin.js +++ b/plugins/filebrowser/plugin.js @@ -219,9 +219,11 @@ // elements Array of {@link CKEDITOR.dialog.definition.content} // objects. function attachFileBrowser( editor, dialogName, definition, elements ) { + if (!elements) return; + var element, fileInput; - for ( var i in elements ) { + for ( var i = 0, l = elements.length; i < l; ++i) { element = elements[ i ]; if ( element.type == 'hbox' || element.type == 'vbox' || element.type == 'fieldset' ) From b1aa1ad992882db69ddeb6c11cb279b680e75cdb Mon Sep 17 00:00:00 2001 From: Aleksander Nowodzinski Date: Tue, 26 Mar 2013 12:25:02 +0100 Subject: [PATCH 2/3] Simplified the loop. Fixed code-style. --- plugins/filebrowser/plugin.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/plugins/filebrowser/plugin.js b/plugins/filebrowser/plugin.js index 2566637905f..5e2cae29a92 100644 --- a/plugins/filebrowser/plugin.js +++ b/plugins/filebrowser/plugin.js @@ -219,11 +219,12 @@ // elements Array of {@link CKEDITOR.dialog.definition.content} // objects. function attachFileBrowser( editor, dialogName, definition, elements ) { - if (!elements) return; + if ( !elements || !elements.length ) + return; var element, fileInput; - for ( var i = 0, l = elements.length; i < l; ++i) { + for ( var i = elements.length; i--; ) { element = elements[ i ]; if ( element.type == 'hbox' || element.type == 'vbox' || element.type == 'fieldset' ) From c16e2572bc5a8f47f26cabe40ed09d62f977f993 Mon Sep 17 00:00:00 2001 From: Aleksander Nowodzinski Date: Tue, 2 Apr 2013 16:17:13 +0200 Subject: [PATCH 3/3] Changelog entry. --- CHANGES.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGES.md b/CHANGES.md index 9dfb7a16c1e..0da239e7bc1 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -5,6 +5,7 @@ CKEditor 4 Changelog * [#10172](http://dev.ckeditor.com/ticket/10172): Pressing delete/backspace in empty table cell moves cursor to next/previous cell. * [#10219](http://dev.ckeditor.com/ticket/10219): Error thrown when destroying an instance in parallel with a mouseup event. +* [#10265](http://dev.ckeditor.com/ticket/10265): Wrong loop type in filebrowser plugin. ## CKEditor 4.1