[FEATURE] RTE: Avoid overhead of Ext.each and Ext.iterate 83/33383/4
authorStanislas Rolland <typo3@sjbr.ca>
Sat, 18 Oct 2014 17:27:26 +0000 (13:27 -0400)
committerStanislas Rolland <typo3@sjbr.ca>
Sun, 19 Oct 2014 14:33:44 +0000 (16:33 +0200)
Improve performance by replacing Ext.each and Ext.iterate with
standard JS for statements.

Releases: master
Resolves: #62321
Change-Id: Id17994d4deadb6786b8c8a5071928bcb38bb2407
Reviewed-on: http://review.typo3.org/33383
Reviewed-by: Stanislas Rolland <typo3@sjbr.ca>
Tested-by: Stanislas Rolland <typo3@sjbr.ca>
21 files changed:
typo3/sysext/rtehtmlarea/htmlarea/htmlarea.js
typo3/sysext/rtehtmlarea/htmlarea/plugins/AboutEditor/about-editor.js
typo3/sysext/rtehtmlarea/htmlarea/plugins/BlockElements/block-elements.js
typo3/sysext/rtehtmlarea/htmlarea/plugins/BlockStyle/block-style.js
typo3/sysext/rtehtmlarea/htmlarea/plugins/CharacterMap/character-map.js
typo3/sysext/rtehtmlarea/htmlarea/plugins/ContextMenu/context-menu.js
typo3/sysext/rtehtmlarea/htmlarea/plugins/CopyPaste/copy-paste.js
typo3/sysext/rtehtmlarea/htmlarea/plugins/DefaultImage/default-image.js
typo3/sysext/rtehtmlarea/htmlarea/plugins/DefaultInline/default-inline.js
typo3/sysext/rtehtmlarea/htmlarea/plugins/DefinitionList/definition-list.js
typo3/sysext/rtehtmlarea/htmlarea/plugins/EditElement/edit-element.js
typo3/sysext/rtehtmlarea/htmlarea/plugins/FindReplace/find-replace.js
typo3/sysext/rtehtmlarea/htmlarea/plugins/InlineElements/inline-elements.js
typo3/sysext/rtehtmlarea/htmlarea/plugins/MicrodataSchema/microdata-schema.js
typo3/sysext/rtehtmlarea/htmlarea/plugins/PlainText/plain-text.js
typo3/sysext/rtehtmlarea/htmlarea/plugins/QuickTag/quick-tag.js
typo3/sysext/rtehtmlarea/htmlarea/plugins/RemoveFormat/remove-format.js
typo3/sysext/rtehtmlarea/htmlarea/plugins/SelectFont/select-font.js
typo3/sysext/rtehtmlarea/htmlarea/plugins/SpellChecker/spell-checker.js
typo3/sysext/rtehtmlarea/htmlarea/plugins/TableOperations/table-operations.js
typo3/sysext/rtehtmlarea/htmlarea/plugins/TextStyle/text-style.js

index bf02de9..5d2ff98 100644 (file)
@@ -386,16 +386,22 @@ Ext.ux.HTMLAreaButton = Ext.extend(Ext.Button, {
                        }
                        contexts = new RegExp( '^(' + contexts.join('|') + ')$', 'i');
                        var matchAny = contexts.test('*');
-                       Ext.each(ancestors, function (ancestor) {
+                       var i, j, n;
+                       for (i = 0, n = ancestors.length; i < n; i++) {
+                               var ancestor = ancestors[i];
                                inContext = matchAny || contexts.test(ancestor.nodeName);
                                if (inContext) {
-                                       Ext.each(attributes, function (attribute) {
-                                               inContext = eval("ancestor." + attribute);
-                                               return inContext;
-                                       });
+                                       for (j = attributes.length; --j >= 0;) {
+                                               inContext = eval("ancestor." + attributes[j]);
+                                               if (!inContext) {
+                                                       break;
+                                               }
+                                       }
                                }
-                               return !inContext;
-                       });
+                               if (inContext) {
+                                       break;
+                               }
+                       }
                }
                return inContext && (!this.selection || !selectionEmpty);
        },
@@ -717,43 +723,47 @@ HTMLArea.Toolbar = Ext.extend(Ext.Container, {
        getEditor: function() {
                return RTEarea[this.editorId].editor;
        },
-       /*
+       /**
         * Create the toolbar items based on editor toolbar configuration
         */
        addItems: function () {
                var editor = this.getEditor();
-                       // Walk through the editor toolbar configuration nested arrays: [ toolbar [ row [ group ] ] ]
+               // Walk through the editor toolbar configuration nested arrays: [ toolbar [ row [ group ] ] ]
                var firstOnRow = true;
                var firstInGroup = true;
-               Ext.each(editor.config.toolbar, function (row) {
+               var i, j, k, n, m, p, row, group, item;
+               for (i = 0, n = editor.config.toolbar.length; i < n; i++) {
+                       row = editor.config.toolbar[i];
                        if (!firstOnRow) {
-                                       // If a visible item was added to the previous line
+                               // If a visible item was added to the previous line
                                this.add({
                                        xtype: 'tbspacer',
                                        cls: 'x-form-clear-left'
                                });
                        }
                        firstOnRow = true;
-                               // Add the groups
-                       Ext.each(row, function (group) {
-                                       // To do: this.config.keepButtonGroupTogether ...
+                       // Add the groups
+                       for (j = 0, m = row.length; j < m; j++) {
+                               group = row[j];
+                               // To do: this.config.keepButtonGroupTogether ...
                                if (!firstOnRow && !firstInGroup) {
-                                               // If a visible item was added to the line
+                                       // If a visible item was added to the line
                                        this.add({
                                                xtype: 'tbseparator',
                                                cls: 'separator'
                                        });
                                }
                                firstInGroup = true;
-                                       // Add each item
-                               Ext.each(group, function (item) {
+                               // Add each item
+                               for (k = 0, p = group.length; k < p; k++) {
+                                       item = group[k];
                                        if (item == 'space') {
                                                this.add({
                                                        xtype: 'tbspacer',
                                                        cls: 'space'
                                                });
                                        } else {
-                                                       // Get the item's config as registered by some plugin
+                                               // Get the item's config as registered by some plugin
                                                var itemConfig = editor.config.buttonsConfig[item];
                                                if (!Ext.isEmpty(itemConfig)) {
                                                        itemConfig.id = this.editorId + '-' + itemConfig.id;
@@ -762,12 +772,9 @@ HTMLArea.Toolbar = Ext.extend(Ext.Container, {
                                                        firstOnRow = firstOnRow && firstInGroup;
                                                }
                                        }
-                                       return true;
-                               }, this);
-                               return true;
-                       }, this);
-                       return true;
-               }, this);
+                               }
+                       }
+               }
                this.add({
                        xtype: 'tbspacer',
                        cls: 'x-form-clear-left'
@@ -869,8 +876,8 @@ HTMLArea.Iframe = Ext.extend(Ext.BoxComponent, {
                                stopEvent: true,
                                delay: 50
                        };
-                       Ext.each(this.nestedParentElements.sorted, function (nested) {
-                               var nestedElement = Ext.get(nested);
+                       for (var i = this.nestedParentElements.sorted.length; --i >= 0;) {
+                               var nestedElement = Ext.get(this.nestedParentElements.sorted[i]);
                                this.mon(
                                        nestedElement,
                                        Ext.isIE ? 'propertychange' : 'DOMAttrModified',
@@ -885,7 +892,7 @@ HTMLArea.Iframe = Ext.extend(Ext.BoxComponent, {
                                        this,
                                        options
                                );
-                       }, this);
+                       }
                }
        },
        /*
@@ -985,9 +992,9 @@ HTMLArea.Iframe = Ext.extend(Ext.BoxComponent, {
         */
        initializeCustomTags: function () {
                if (HTMLArea.isIEBeforeIE9) {
-                       Ext.each(this.config.customTags, function (tag) {
-                               this.document.createElement(tag);
-                       }, this);
+                       for (var i = this.config.customTags.length; --i >= 0;) {
+                               this.document.createElement(this.config.customTags[i]);
+                       }
                }
        },
        /*
@@ -1207,13 +1214,13 @@ HTMLArea.Iframe = Ext.extend(Ext.BoxComponent, {
                                scope: this
                        });
                }
-                       // Hot key map (on keydown for all browsers)
+               // Hot key map (on keydown for all browsers)
                var hotKeys = '';
-               Ext.iterate(this.config.hotKeyList, function (key) {
+               for (var key in this.config.hotKeyList) {
                        if (key.length == 1) {
                                hotKeys += key.toUpperCase();
                        }
-               });
+               }
                        // Make hot key map available, even if empty, so that plugins may add bindings
                this.hotKeyMap = new Ext.KeyMap(Ext.get(this.document.documentElement));
                if (!Ext.isEmpty(hotKeys)) {
@@ -1425,19 +1432,19 @@ HTMLArea.Iframe = Ext.extend(Ext.BoxComponent, {
                this.getButton(this.config.hotKeyList[hotKey].cmd).fireEvent('HTMLAreaEventHotkey', hotKey, event);
                return false;
        },
-       /*
+       /**
         * Cleanup
         */
        onBeforeDestroy: function () {
-                       // ExtJS KeyMap object makes IE leak memory
-                       // Nullify EXTJS private handlers
-               Ext.each(this.keyMap.bindings, function (binding, index) {
+               // ExtJS KeyMap object makes IE leak memory
+               // Nullify EXTJS private handlers
+               for (var index = this.keyMap.bindings.length; --index >= 0;) {
                        this.keyMap.bindings[index] = null;
-               }, this);
+               }
                this.keyMap.handleKeyDown = null;
-               Ext.each(this.hotKeyMap.bindings, function (binding, index) {
+               for (var index = this.hotKeyMap.bindings.length; --index >= 0;) {
                        this.hotKeyMap.bindings[index] = null;
-               }, this);
+               }
                this.hotKeyMap.handleKeyDown = null;
                this.keyMap.disable();
                this.hotKeyMap.disable();
@@ -1448,10 +1455,11 @@ HTMLArea.Iframe = Ext.extend(Ext.BoxComponent, {
                Ext.get(this.document.documentElement).dom = null;
                this.document = null;
                this.getEditor().document = null;
-               Ext.each(this.nestedParentElements.sorted, function (nested) {
+               for (var index = this.nestedParentElements.sorted.length; --index >= 0;) {
+                       var nested = this.nestedParentElements.sorted[index];
                        Ext.get(nested).purgeAllListeners();
                        Ext.get(nested).dom = null;
-               });
+               }
                Ext.destroy(this.autoEl, this.el, this.resizeEl, this.positionEl);
                return true;
        }
@@ -1535,11 +1543,13 @@ HTMLArea.StatusBar = Ext.extend(Ext.Container, {
         */
        clear: function () {
                this.statusBarTree.removeAllListeners();
-               Ext.each(this.statusBarTree.query('a'), function (node) {
+               var statusBarNodes = this.statusBarTree.query('a');
+               for (var i = statusBarNodes.length; --i >= 0;) {
+                       var node = statusBarNodes[i];
                        Ext.QuickTips.unregister(node);
                        Ext.get(node).dom.ancestor = null;
                        Ext.destroy(node);
-               });
+               }
                this.statusBarTree.update('');
                this.setSelection(null);
        },
@@ -1562,9 +1572,11 @@ HTMLArea.StatusBar = Ext.extend(Ext.Container, {
                                tag: 'span',
                                html: HTMLArea.localize('Path') + ': '
                        },true);
-                       Ext.each(ancestors, function (ancestor, index) {
+                       var index, n, j, m;
+                       for (index = 0, n = ancestors.length; index < n; index++) {
+                               var ancestor = ancestors[index];
                                if (!ancestor) {
-                                       return true;
+                                       continue;
                                }
                                text = ancestor.nodeName.toLowerCase();
                                        // Do not show any id generated by ExtJS
@@ -1580,7 +1592,7 @@ HTMLArea.StatusBar = Ext.extend(Ext.Container, {
                                if (ancestor.className) {
                                        classText = '';
                                        classes = ancestor.className.trim().split(' ');
-                                       for (var j = 0, n = classes.length; j < n; ++j) {
+                                       for (j = 0, m = classes.length; j < m; ++j) {
                                                if (!HTMLArea.reservedClassNames.test(classes[j])) {
                                                        classText += '.' + classes[j];
                                                }
@@ -1607,7 +1619,7 @@ HTMLArea.StatusBar = Ext.extend(Ext.Container, {
                                                html: String.fromCharCode(0xbb)
                                        });
                                }
-                       }, this);
+                       }
                }
                this.updateWordCount();
                this.noUpdate = false;
@@ -1980,20 +1992,19 @@ HTMLArea.Framework = Ext.extend(Ext.Panel, {
                        this.onIframeReady.defer(50, this);
                }
        },
-       /*
+       /**
         * Handler invoked if we are inside a form and the form is reset
         * On reset, re-initialize the HTMLArea content and update the toolbar
         */
        onReset: function (event) {
                this.getEditor().setHTML(this.textArea.getValue());
                this.toolbar.update();
-                       // Invoke previous reset handlers, if any
+               // Invoke previous reset handlers, if any
                var htmlAreaPreviousOnReset = event.getTarget().dom.htmlAreaPreviousOnReset;
                if (typeof(htmlAreaPreviousOnReset) != 'undefined') {
-                       Ext.each(htmlAreaPreviousOnReset, function (onReset) {
-                               onReset();
-                               return true;
-                       });
+                       for (var i = 0, n = htmlAreaPreviousOnReset.length; i < n; i++) {
+                               htmlAreaPreviousOnReset[i]();
+                       }
                }
        },
        /*
@@ -2062,14 +2073,14 @@ HTMLArea.Editor = Ext.extend(Ext.util.Observable, {
                                this.wizards.hide();
                        }
                }
-                       // Plugins register
+               // Plugins register
                this.plugins = {};
-                       // Register the plugins included in the configuration
-               Ext.iterate(this.config.plugin, function (plugin) {
+               // Register the plugins included in the configuration
+               for (var plugin in this.config.plugin) {
                        if (this.config.plugin[plugin]) {
                                this.registerPlugin(plugin);
                        }
-               }, this);
+               }
                        // Create Ajax object
                this.ajax = new HTMLArea.Ajax({
                        editor: this
@@ -2249,15 +2260,16 @@ HTMLArea.Editor = Ext.extend(Ext.util.Observable, {
                if (this.wizards) {
                        this.wizards.show();
                }
-                       // Focus on the first editor that is not hidden
-               Ext.iterate(RTEarea, function (editorId, RTE) {
+               // Focus on the first editor that is not hidden
+               for (var editorId in RTEarea) {
+                       var RTE = RTEarea[editorId];
                        if (!Ext.isDefined(RTE.editor) || (RTE.editor.isNested && !HTMLArea.util.TYPO3.allElementsAreDisplayed(RTE.editor.nestedParentElements.sorted))) {
-                               return true;
+                               continue;
                        } else {
                                RTE.editor.focus();
-                               return false;
+                               break;
                        }
-               }, this);
+               }
                this.ready = true;
                this.fireEvent('HTMLAreaEventEditorReady');
                this.appendToLog('HTMLArea.Editor', 'onFrameworkReady', 'Editor ready.', 'info');
@@ -2297,9 +2309,9 @@ HTMLArea.Editor = Ext.extend(Ext.util.Observable, {
                }
                this.fireEvent('HTMLAreaEventModeChange', this.mode);
                this.focus();
-               Ext.iterate(this.plugins, function(pluginId) {
+               for (var pluginId in this.plugins) {
                        this.getPlugin(pluginId).onMode(this.mode);
-               }, this);
+               }
        },
        /*
         * Get current editor mode
@@ -2372,11 +2384,12 @@ HTMLArea.Editor = Ext.extend(Ext.util.Observable, {
         */
        getNodeByPosition: function (position, normalized) {
                var current = this.document.documentElement;
-               for (var i = 0, n = position.length; current && i < n; i++) {
+               var i, j, n, m;
+               for (i = 0, n = position.length; current && i < n; i++) {
                        var target = position[i];
                        if (normalized) {
                                var currentIndex = -1;
-                               for (var j = 0, m = current.childNodes.length; j < m; j++) {
+                               for (j = 0, m = current.childNodes.length; j < m; j++) {
                                        var candidate = current.childNodes[j];
                                        if (
                                                candidate.nodeType == HTMLArea.DOM.TEXT_NODE
@@ -2425,10 +2438,10 @@ HTMLArea.Editor = Ext.extend(Ext.util.Observable, {
         * Generate registered plugins
         */
        generatePlugins: function () {
-               Ext.iterate(this.plugins, function (pluginId) {
+               for (var pluginId in this.plugins) {
                        var plugin = this.getPlugin(pluginId);
                        plugin.onGenerate();
-               }, this);
+               }
        },
        /*
         * Get the instance of the specified plugin, if it exists
@@ -2523,11 +2536,11 @@ HTMLArea.Editor = Ext.extend(Ext.util.Observable, {
                                value: this.getHTML()
                        }, false);
                }
-                       // Cleanup
+               // Cleanup
                Ext.TaskMgr.stopAll();
-               Ext.iterate(this.plugins, function (pluginId) {
+               for (var pluginId in this.plugins) {
                        this.unRegisterPlugin(pluginId);
-               }, this);
+               }
                this.purgeListeners();
                        // Cleaning references to DOM in order to avoid IE memory leaks
                if (this.wizards) {
@@ -2587,9 +2600,9 @@ HTMLArea.Ajax = Ext.extend(HTMLArea.Ajax, {
                var self = this;
                data.charset = this.editor.config.typo3ContentCharset ? this.editor.config.typo3ContentCharset : 'utf-8';
                var params = '';
-               Ext.iterate(data, function (parameter, value) {
-                       params += (params.length ? '&' : '') + parameter + '=' + encodeURIComponent(value);
-               });
+               for (var parameter in data) {
+                       params += (params.length ? '&' : '') + parameter + '=' + encodeURIComponent(data[parameter]);
+               }
                params += this.editor.config.RTEtsConfigParams;
                Ext.Ajax.request({
                        method: 'POST',
@@ -2699,10 +2712,12 @@ HTMLArea.util.TYPO3 = function () {
                 */
                allElementsAreDisplayed: function(elements) {
                        var allDisplayed = true;
-                       Ext.each(elements, function (element) {
-                               allDisplayed = Ext.get(element).getStyle('display') != 'none';
-                               return allDisplayed;
-                       });
+                       for (var i = elements.length; --i >= 0;) {
+                               allDisplayed = Ext.get(elements[i]).getStyle('display') !== 'none';
+                               if (!allDisplayed) {
+                                       break;
+                               }
+                       }
                        return allDisplayed;
                },
                /*
@@ -2821,7 +2836,7 @@ HTMLArea.DOM = function () {
                                if (HTMLArea.reservedClassNames.test(node.className)) {
                                        var cleanClassNames = [];
                                        var j = -1;
-                                       for (var i = 0; i < classNames.length; ++i) {
+                                       for (var i = 0, n = classNames.length; i < n; ++i) {
                                                if (!HTMLArea.reservedClassNames.test(classNames[i])) {
                                                        cleanClassNames[++j] = classNames[i];
                                                }
@@ -3836,7 +3851,8 @@ HTMLArea.DOM.Selection = Ext.extend(HTMLArea.DOM.Selection, {
                        var type = this.getType();
                        var range = this.createRange();
                        var ancestors = this.getAllAncestors();
-                       Ext.each(ancestors, function (ancestor) {
+                       for (var i = 0, n = ancestors.length; i < n; i++) {
+                               var ancestor = ancestors[i];
                                if (HTMLArea.isIEBeforeIE9) {
                                        isFullySelected = (type !== 'Control' && ancestor.innerText == range.text) || (type === 'Control' && ancestor.innerText == range.item(0).text);
                                } else {
@@ -3844,9 +3860,9 @@ HTMLArea.DOM.Selection = Ext.extend(HTMLArea.DOM.Selection, {
                                }
                                if (isFullySelected) {
                                        node = ancestor;
-                                       return false;
+                                       break;
                                }
-                       });
+                       }
                                // Working around bug with WebKit selection
                        if (Ext.isWebKit && !isFullySelected) {
                                var statusBarSelection = this.editor.statusBar ? this.editor.statusBar.getSelection() : null;
@@ -4240,14 +4256,14 @@ HTMLArea.DOM.Selection = Ext.extend(HTMLArea.DOM.Selection, {
         */
        checkInsertParagraph: function() {
                var editor = this.editor;
-               var i, left, right, rangeClone,
+               var left, right, rangeClone,
                        sel     = this.get().selection,
                        range   = this.createRange(),
                        p       = this.getAllAncestors(),
                        block   = null,
                        a       = null,
                        doc     = this.document;
-               for (i = 0; i < p.length; ++i) {
+               for (var i = 0, n = p.length; i < n; ++i) {
                        if (HTMLArea.DOM.isBlockElement(p[i]) && !/^(html|body|table|tbody|thead|tfoot|tr|dl)$/i.test(p[i].nodeName)) {
                                block = p[i];
                                break;
@@ -5073,15 +5089,17 @@ HTMLArea.CSS.Parser = Ext.extend(Ext.util.Observable, {
                if (this.cssLoaded) {
                                // Expecting 2 stylesheets...
                        if (this.editor.document.styleSheets.length > 1) {
-                               Ext.each(this.editor.document.styleSheets, function (styleSheet, index) {
+                               var styleSheets = this.editor.document.styleSheets;
+                               for (var index = 0, n = styleSheets.length; index < n; index++) {
                                        try {
+                                               var styleSheet = styleSheets[index];
                                                if (HTMLArea.isIEBeforeIE9) {
                                                        var rules = styleSheet.rules;
                                                        var imports = styleSheet.imports;
                                                        if (!rules.length && !imports.length) {
                                                                this.cssLoaded = false;
                                                                this.error = 'Empty rules and imports arrays of styleSheets[' + index + ']';
-                                                               return false;
+                                                               break;
                                                        }
                                                        if (styleSheet.imports) {
                                                                this.parseIeRules(styleSheet.imports);
@@ -5096,9 +5114,9 @@ HTMLArea.CSS.Parser = Ext.extend(Ext.util.Observable, {
                                                this.error = e;
                                                this.cssLoaded = false;
                                                this.parsedClasses = {};
-                                               return false;
+                                               break;
                                        }
-                               }, this);
+                               }
                        } else {
                                this.cssLoaded = false;
                                this.error = 'Empty stylesheets array or missing linked stylesheets';
@@ -5112,7 +5130,7 @@ HTMLArea.CSS.Parser = Ext.extend(Ext.util.Observable, {
         * @return      void
         */
        parseRules: function (cssRules) {
-               for (var rule = 0; rule < cssRules.length; rule++) {
+               for (var rule = 0, n = cssRules.length; rule < n; rule++) {
                                // Style rule
                        if (cssRules[rule].selectorText) {
                                this.parseSelectorText(cssRules[rule].selectorText);
@@ -5144,7 +5162,7 @@ HTMLArea.CSS.Parser = Ext.extend(Ext.util.Observable, {
         * @return      void
         */
        parseIeRules: function (cssRules) {
-               for (var rule = 0; rule < cssRules.length; rule++) {
+               for (var rule = 0, n = cssRules.length; rule < n; rule++) {
                                // Import rule
                        if (cssRules[rule].imports) {
                                this.parseIeRules(cssRules[rule].imports);
@@ -5169,7 +5187,7 @@ HTMLArea.CSS.Parser = Ext.extend(Ext.util.Observable, {
                if (selectorText.search(/:+/) == -1) {
                                // Split equal styles
                        cssElements = selectorText.split(',');
-                       for (var k = 0; k < cssElements.length; k++) {
+                       for (var k = 0, n = cssElements.length; k < n; k++) {
                                        // Match all classes (<element name (optional)>.<class name>) in selector rule
                                var s = cssElements[k], index;
                                while ((index = s.search(pattern)) > -1) {
@@ -5202,47 +5220,48 @@ HTMLArea.CSS.Parser = Ext.extend(Ext.util.Observable, {
         * @return      void
         */
        filterAllowedClasses: function() {
-               Ext.iterate(this.tags, function (nodeName) {
+               var nodeName, cssClass;
+               for (nodeName in this.tags) {
                        var allowedClasses = {};
-                               // Get classes allowed for all tags
+                       // Get classes allowed for all tags
                        if (nodeName !== 'all' && Ext.isDefined(this.parsedClasses['all'])) {
                                if (this.tags && this.tags[nodeName] && this.tags[nodeName].allowedClasses) {
                                        var allowed = this.tags[nodeName].allowedClasses;
-                                       Ext.iterate(this.parsedClasses['all'], function (cssClass, value) {
+                                       for (cssClass in this.parsedClasses['all']) {
                                                if (allowed.test(cssClass)) {
-                                                       allowedClasses[cssClass] = value;
+                                                       allowedClasses[cssClass] = this.parsedClasses['all'][cssClass];
                                                }
-                                       });
+                                       }
                                } else {
                                        allowedClasses = this.parsedClasses['all'];
                                }
                        }
-                               // Merge classes allowed for nodeName
+                       // Merge classes allowed for nodeName
                        if (Ext.isDefined(this.parsedClasses[nodeName])) {
                                if (this.tags && this.tags[nodeName] && this.tags[nodeName].allowedClasses) {
                                        var allowed = this.tags[nodeName].allowedClasses;
-                                       Ext.iterate(this.parsedClasses[nodeName], function (cssClass, value) {
+                                       for (cssClass in this.parsedClasses[nodeName]) {
                                                if (allowed.test(cssClass)) {
-                                                       allowedClasses[cssClass] = value;
+                                                       allowedClasses[cssClass] = this.parsedClasses[nodeName][cssClass];
                                                }
-                                       });
+                                       }
                                } else {
-                                       Ext.iterate(this.parsedClasses[nodeName], function (cssClass, value) {
-                                               allowedClasses[cssClass] = value;
-                                       });
+                                       for (cssClass in this.parsedClasses[nodeName]) {
+                                               allowedClasses[cssClass] = this.parsedClasses[nodeName][cssClass];
+                                       }
                                }
                        }
                        this.parsedClasses[nodeName] = allowedClasses;
-               }, this);
-                       // If showTagFreeClasses is set and there is no allowedClasses clause on a tag, merge classes allowed for all tags
+               }
+               // If showTagFreeClasses is set and there is no allowedClasses clause on a tag, merge classes allowed for all tags
                if (this.showTagFreeClasses && Ext.isDefined(this.parsedClasses['all'])) {
-                       Ext.iterate(this.parsedClasses, function (nodeName) {
+                       for (nodeName in this.parsedClasses) {
                                if (nodeName !== 'all' && !this.tags[nodeName]) {
-                                       Ext.iterate(this.parsedClasses['all'], function (cssClass, value) {
-                                               this.parsedClasses[nodeName][cssClass] = value;
-                                       }, this);
+                                       for (cssClass in this.parsedClasses['all']) {
+                                               this.parsedClasses[nodeName][cssClass] = this.parsedClasses['all'][cssClass];
+                                       }
                                }
-                       }, this);
+                       }
                }
        },
        /*
@@ -5251,25 +5270,27 @@ HTMLArea.CSS.Parser = Ext.extend(Ext.util.Observable, {
         * @return      void
         */
        sort: function() {
-               Ext.iterate(this.parsedClasses, function (nodeName, value) {
+               var nodeName, cssClass, i, n;
+               for (nodeName in this.parsedClasses) {
+                       var value = this.parsedClasses[nodeName];
                        var classes = [];
                        var sortedClasses= {};
-                               // Collect keys
-                       Ext.iterate(value, function (cssClass) {
+                       // Collect keys
+                       for (cssClass in value) {
                                classes.push(cssClass);
-                       });
+                       }
                        function compare(a, b) {
                                x = value[a];
                                y = value[b];
                                return ((x < y) ? -1 : ((x > y) ? 1 : 0));
                        }
-                               // Sort keys by comparing texts
+                       // Sort keys by comparing texts
                        classes = classes.sort(compare);
-                       for (var i = 0; i < classes.length; ++i) {
+                       for (i = 0, n = classes.length; i < n; ++i) {
                                sortedClasses[classes[i]] = value[classes[i]];
                        }
                        this.parsedClasses[nodeName] = sortedClasses;
-               }, this);
+               }
        }
 });
 /***************************************************
@@ -5710,13 +5731,20 @@ HTMLArea.Plugin = Ext.extend(HTMLArea.Plugin, {
         */
        isButtonInToolbar: function (buttonId) {
                var index = -1;
-               Ext.each(this.editorConfiguration.toolbar, function (row) {
-                       Ext.each(row, function (group) {
+               var i, j, n, m;
+               for (i = 0, n = this.editorConfiguration.toolbar.length; i < n; i++) {
+                       var row = this.editorConfiguration.toolbar[i];
+                       for (j = 0, m = row.length; j < m; j++) {
+                               var group = row[j];
                                index = group.indexOf(buttonId);
-                               return index === -1;
-                       });
-                       return index === -1;
-               });
+                               if (index !== -1) {
+                                       break;
+                               }
+                       }
+                       if (index !== -1) {
+                               break;
+                       }
+               }
                return index !== -1;
        },
 
index 521c719..e9a4e8d 100644 (file)
@@ -142,7 +142,7 @@ HTMLArea.AboutEditor = Ext.extend(HTMLArea.Plugin, {
                                        + '<br />'
                                        + '&copy; 2002-2004 <a href="http://interactivetools.com" target="_blank">interactivetools.com, inc.</a><br />'
                                        + '&copy; 2003-2004 <a href="http://dynarch.com" target="_blank">dynarch.com LLC.</a><br />'
-                                       + '&copy; 2004-2010 <a href="http://www.sjbr.ca" target="_blank">Stanislas Rolland</a><br />'
+                                       + '&copy; 2004-2014 <a href="http://www.sjbr.ca" target="_blank">Stanislas Rolland</a><br />'
                                        + this.localize('All rights reserved.')
                                + '</p>'
                });
@@ -184,19 +184,20 @@ HTMLArea.AboutEditor = Ext.extend(HTMLArea.Plugin, {
                return tabItems;
        },
        /*
-        * Format an arry of information on each configured plugin
+        * Format an array of information on each configured plugin
         *
         * @return      array           array of data objects
         */
        getPluginsInfo: function () {
                var pluginsInfo = [];
-               Ext.iterate(this.editor.plugins, function (pluginId, plugin) {
+               for (var pluginId in this.editor.plugins) {
+                       var plugin = this.editor.plugins[pluginId];
                        pluginsInfo.push([
                                plugin.name + ' ' + plugin.version,
                                '<a href="' + plugin.developerUrl + '" target="_blank">' + plugin.developer + '</a>',
                                '<a href="' + plugin.sponsorUrl + '" target="_blank">' + plugin.sponsor + '</a>'
                        ]);
-               }, this);
+               }
                return pluginsInfo;
        }
 });
index 7046215..1b8174e 100644 (file)
@@ -116,12 +116,13 @@ HTMLArea.BlockElements = Ext.extend(HTMLArea.Plugin, {
                /*
                 * Establishing the list of allowed block elements
                 */
-               var blockElements = new Array();
-               Ext.each(dropDownConfiguration.options, function (option) {
+               var blockElements = new Array(), option;
+               for (var i = 0, n = dropDownConfiguration.options.length; i < n; i++) {
+                       option = dropDownConfiguration.options[i];
                        if (option[1] != 'none') {
                                blockElements.push(option[1]);
                        }
-               });
+               }
                if (blockElements.length) {
                        this.allowedBlockElements = new RegExp( "^(" + blockElements.join("|") + ")$", "i");
                } else {
@@ -130,8 +131,10 @@ HTMLArea.BlockElements = Ext.extend(HTMLArea.Plugin, {
                /*
                 * Registering hot keys for the dropdown list items
                 */
-               Ext.each(blockElements, function (blockElement) {
-                       var configuredHotKey = this.defaultHotKeys[blockElement];
+               var blockElement, configuredHotKey;
+               for (var i = 0, n = blockElements.length; i < n; i++) {
+                       blockElement = blockElements[i];
+                       configuredHotKey = this.defaultHotKeys[blockElement];
                        if (this.editorConfiguration.buttons.formatblock
                                        && this.editorConfiguration.buttons.formatblock.items
                                        && this.editorConfiguration.buttons.formatblock.items[blockElement]
@@ -146,7 +149,7 @@ HTMLArea.BlockElements = Ext.extend(HTMLArea.Plugin, {
                                };
                                this.registerHotKey(hotKeyConfiguration);
                        }
-               }, this);
+               }
                /*
                 * Registering the buttons
                 */
index 682aac8..24beb97 100644 (file)
@@ -238,7 +238,7 @@ HTMLArea.BlockStyle = Ext.extend(HTMLArea.Plugin, {
                        } else if (this.showTagFreeClasses && Ext.isDefined(this.cssArray['all'])) {
                                allowedClasses = this.cssArray['all'];
                        }
-                       Ext.iterate(allowedClasses, function (cssClass, value) {
+                       for (var cssClass in allowedClasses) {
                                var style = null;
                                if (!this.pageTSconfiguration.disableStyleOnOptionLabel) {
                                        if (HTMLArea.classesValues[cssClass] && !HTMLArea.classesNoShow[cssClass]) {
@@ -248,11 +248,11 @@ HTMLArea.BlockStyle = Ext.extend(HTMLArea.Plugin, {
                                        }
                                }
                                store.add(new store.recordType({
-                                       text: value,
+                                       text: allowedClasses[cssClass],
                                        value: cssClass,
                                        style: style
                                }));
-                       }, this);
+                       }
                }
        },
        /*
index c7656e9..179633e 100644 (file)
@@ -50,11 +50,12 @@ HTMLArea.CharacterMap = Ext.extend(HTMLArea.Plugin, {
                /*
                 * Localizing the maps
                 */
-               Ext.iterate(this.maps, function (key, map, maps) {
+               for (var key in this.maps) {
+                       var map = this.maps[key];
                        for (var i = map.length; --i >= 0;) {
-                               maps[key][i].push(this.localize(map[i][1]));
+                               this.maps[key][i].push(this.localize(map[i][1]));
                        }
-               }, this);
+               }
                return true;
         },
        /*
@@ -404,7 +405,7 @@ HTMLArea.CharacterMap = Ext.extend(HTMLArea.Plugin, {
         */
        buildTabItems: function () {
                var tabItems = [];
-               Ext.iterate(this.maps, function (id, map) {
+               for (var id in this.maps) {
                        tabItems.push({
                                xtype: 'box',
                                cls: 'character-map',
@@ -420,7 +421,7 @@ HTMLArea.CharacterMap = Ext.extend(HTMLArea.Plugin, {
                                        }
                                }
                        });
-               }, this);
+               }
                return tabItems;
        },
        /*
index 38dddb4..3b12886 100644 (file)
@@ -72,17 +72,20 @@ HTMLArea.ContextMenu = Ext.extend(HTMLArea.Plugin, {
                        // Monitor editor being destroyed
                this.menu.mon(this.editor, 'beforedestroy', this.onBeforeDestroy, this, {single: true});
        },
-       /*
+       /**
         * Create the menu items config
         */
        buildItemsConfig: function () {
                var itemsConfig = [];
-                       // Walk through the editor toolbar configuration nested arrays: [ toolbar [ row [ group ] ] ]
+               // Walk through the editor toolbar configuration nested arrays: [ toolbar [ row [ group ] ] ]
                var firstInGroup = true, convertedItemId;
-               Ext.each(this.editor.config.toolbar, function (row) {
-                               // Add the groups
+               var i, j ,k, n, m, p, row, group, itemId;
+               for (i = 0, n = this.editor.config.toolbar.length; i < n; i++) {
+                       row = this.editor.config.toolbar[i];
+                       // Add the groups
                        firstInGroup = true;
-                       Ext.each(row, function (group) {
+                       for (j = 0, m = row.length; j < m; j++) {
+                               group = row[j];
                                if (!firstInGroup) {
                                        // If a visible item was added to the line
                                        itemsConfig.push({
@@ -91,8 +94,9 @@ HTMLArea.ContextMenu = Ext.extend(HTMLArea.Plugin, {
                                        });
                                }
                                firstInGroup = true;
-                                       // Add each item
-                               Ext.each(group, function (itemId) {
+                               // Add each item
+                               for (k = 0, p = group.length; k < p; k++) {
+                                       itemId = group[k];
                                        convertedItemId = this.editorConfiguration.convertButtonId[itemId];
                                        if ((!this.showButtons || this.showButtons.indexOf(convertedItemId) !== -1)
                                                && (!this.hideButtons || this.hideButtons.indexOf(convertedItemId) === -1)) {
@@ -111,21 +115,18 @@ HTMLArea.ContextMenu = Ext.extend(HTMLArea.Plugin, {
                                                        firstInGroup = false;
                                                }
                                        }
-                                       return true;
-                               }, this);
-                               return true;
-                       }, this);
-                       return true;
-               }, this);
-                       // If a visible item was added
+                               }
+                       }
+               }
+               // If a visible item was added
                if (!firstInGroup) {
                        itemsConfig.push({
                                        xtype: 'menuseparator',
                                        cls: 'separator'
                        });
                }
-                       // Add special target delete item
-               var itemId = 'DeleteTarget';
+                // Add special target delete item
+               itemId = 'DeleteTarget';
                itemsConfig.push({
                        itemId: itemId,
                        cls: 'button',
index 4bcbe6a..66f4394 100644 (file)
@@ -38,7 +38,8 @@ HTMLArea.CopyPaste = Ext.extend(HTMLArea.Plugin, {
                /*
                 * Registering the buttons
                 */
-               Ext.iterate(this.buttonList, function (buttonId, button) {
+               for (var buttonId in this.buttonList) {
+                       var button = this.buttonList[buttonId];
                        var buttonConfiguration = {
                                id              : buttonId,
                                tooltip         : this.localize(buttonId.toLowerCase()),
@@ -49,7 +50,7 @@ HTMLArea.CopyPaste = Ext.extend(HTMLArea.Plugin, {
                                hotKey          : button[1]
                        };
                        this.registerButton(buttonConfiguration);
-               }, this);
+               }
                return true;
        },
        /*
@@ -65,7 +66,8 @@ HTMLArea.CopyPaste = Ext.extend(HTMLArea.Plugin, {
         */
        onGenerate: function () {
                this.editor.iframe.mon(Ext.get(Ext.isIE ? this.editor.document.body : this.editor.document.documentElement), 'cut', this.cutHandler, this);
-               Ext.iterate(this.buttonList, function (buttonId, button) {
+               for (var buttonId in this.buttonList) {
+                       var button = this.buttonList[buttonId];
                                // Remove button from toolbar, if command is not supported
                                // Starting with Safari 5 and Chrome 6, cut and copy commands are not supported anymore by WebKit
                                // Starting with Firefox 29, cut, copy and paste commands are not supported anymore by Firefox
@@ -88,7 +90,7 @@ HTMLArea.CopyPaste = Ext.extend(HTMLArea.Plugin, {
                                        cmd     : buttonId
                                };
                        }
-               }, this);
+               }
        },
        /*
         * This function gets called when a button or a hotkey was pressed.
index 7a8a9a9..5539f75 100644 (file)
@@ -403,13 +403,14 @@ HTMLArea.DefaultImage = Ext.extend(HTMLArea.Plugin, {
                var urlField = this.dialog.find('itemId', 'url')[0];
                var url = urlField.getValue().trim();
                if (url) {
-                       var fieldNames = ['url', 'alt', 'align', 'border', 'paddingTop', 'paddingRight', 'paddingBottom', 'paddingLeft', 'cssFloat'];
-                       Ext.each(fieldNames, function (fieldName) {
+                       var fieldNames = ['url', 'alt', 'align', 'border', 'paddingTop', 'paddingRight', 'paddingBottom', 'paddingLeft', 'cssFloat'], fieldName;
+                       for (var i = fieldNames.length; --i >= 0;) {
+                               fieldName = fieldNames[i];
                                var field = this.dialog.find('itemId', fieldName)[0];
                                if (field && !field.hidden) {
                                        this.parameters[fieldName] = field.getValue();
                                }
-                       }, this);
+                       }
                        this.insertImage();
                        this.close();
                } else {
@@ -452,7 +453,9 @@ HTMLArea.DefaultImage = Ext.extend(HTMLArea.Plugin, {
                        image.src = this.parameters.url;
                }
                if (/^img$/i.test(image.nodeName)) {
-                       Ext.iterate(this.parameters, function (fieldName, value) {
+                       var value;
+                       for (var fieldName in this.parameters) {
+                               value = this.parameters[fieldName];
                                switch (fieldName) {
                                        case 'alt':
                                                image.alt = value;
@@ -487,7 +490,7 @@ HTMLArea.DefaultImage = Ext.extend(HTMLArea.Plugin, {
                                                }
                                                break;
                                }
-                       });
+                       }
                }
        },
        /*
index 4bc2e34..d54e13d 100644 (file)
@@ -34,8 +34,10 @@ HTMLArea.DefaultInline = Ext.extend(HTMLArea.Plugin, {
                /*
                 * Registering the buttons
                 */
-               Ext.each(this.buttonList, function (button) {
-                       var buttonId = button[0];
+               var button, buttonId;
+               for (var i = 0, n = this.buttonList.length; i < n; i++) {
+                       button = this.buttonList[i];
+                       buttonId = button[0];
                        var buttonConfiguration = {
                                id              : buttonId,
                                tooltip         : this.localize(buttonId + '-Tooltip'),
@@ -46,8 +48,7 @@ HTMLArea.DefaultInline = Ext.extend(HTMLArea.Plugin, {
                                hotKey          : (this.editorConfiguration.buttons[buttonId.toLowerCase()]?this.editorConfiguration.buttons[buttonId.toLowerCase()].hotKey:null)
                        };
                        this.registerButton(buttonConfiguration);
-                       return true;
-               }, this);
+               }
                return true;
        },
        /*
index dd753c3..d5c2c6d 100644 (file)
@@ -47,8 +47,10 @@ HTMLArea.DefinitionList = Ext.extend(HTMLArea.BlockElements, {
                /*
                 * Registering the buttons
                 */
-               Ext.each(this.buttonList, function (button) {
-                       var buttonId = button[0];
+               var button, buttonId;
+               for (var i = 0, n = this.buttonList.length; i < n; i++) {
+                       button = this.buttonList[i];
+                       buttonId = button[0];
                        var buttonConfiguration = {
                                id              : buttonId,
                                tooltip         : this.localize(buttonId + '-Tooltip'),
@@ -61,7 +63,7 @@ HTMLArea.DefinitionList = Ext.extend(HTMLArea.BlockElements, {
                                noAutoUpdate    : button[4]
                        };
                        this.registerButton(buttonConfiguration);
-               }, this);
+               }
                return true;
        },
        /*
index 87aacb8..eda7864 100644 (file)
@@ -377,7 +377,9 @@ HTMLArea.EditElement = Ext.extend(HTMLArea.Plugin, {
                var itemsConfig = [];
                var events = ['onkeydown', 'onkeypress', 'onkeyup', 'onclick', 'ondblclick', 'onmousedown', 'onmousemove', 'onmouseout', 'onmouseover', 'onmouseup'];
                if (!/^(base|bdo|br|frame|frameset|head|html|iframe|meta|param|script|style|title)$/i.test(element.nodeName)) {
-                       Ext.each(events, function (event) {
+                       var event;
+                       for (var i = 0, n = events.length; i < n; i++) {
+                               event = events[i];
                                if (this.removedProperties.indexOf(event) == -1) {
                                        itemsConfig.push({
                                                itemId: event,
@@ -385,7 +387,7 @@ HTMLArea.EditElement = Ext.extend(HTMLArea.Plugin, {
                                                value: element ? element.getAttribute(event) : ''
                                        });
                                }
-                       }, this);
+                       }
                }
                return itemsConfig.length ? {
                        xtype: 'fieldset',
@@ -422,7 +424,8 @@ HTMLArea.EditElement = Ext.extend(HTMLArea.Plugin, {
        okHandler: function (button, event) {
                this.restoreSelection();
                var textFields = this.dialog.findByType('textfield');
-               Ext.each(textFields, function (field) {
+               for (var i = textFields.length; --i >= 0;) {
+                       var field = textFields[i];
                        if (field.getXType() !== 'combo') {
                                if (field.getValue()) {
                                        this.element.setAttribute(field.getItemId(), field.getValue());
@@ -430,10 +433,11 @@ HTMLArea.EditElement = Ext.extend(HTMLArea.Plugin, {
                                        this.element.removeAttribute(field.getItemId());
                                }
                        }
-               }, this);
+               }
                var comboFields = this.dialog.findByType('combo');
                var languageCombo = this.dialog.find('itemId', 'lang')[0];
-               Ext.each(comboFields, function (field) {
+               for (var i = comboFields.length; --i >= 0;) {
+                       var field = comboFields[i];
                        var itemId = field.getItemId();
                        var value = field.getValue();
                        switch (itemId) {
@@ -449,7 +453,7 @@ HTMLArea.EditElement = Ext.extend(HTMLArea.Plugin, {
                                        this.element.setAttribute(itemId, (value === 'not set') ? '' : value);
                                        break;
                        }
-               }, this);
+               }
                var microdataTab = this.dialog.find('itemId', 'microdata')[0];
                if (microdataTab) {
                        this.getPluginInstance('MicrodataSchema').setMicrodataAttributes(this.element);
index c6b698d..9c433e0 100644 (file)
@@ -277,10 +277,11 @@ HTMLArea.FindReplace = Ext.extend(HTMLArea.Plugin, {
                        'matchCase',
                        'replaceAll'
                ];
-               var params = {};
-               Ext.each(fields, function (field) {
+               var params = {}, field;
+               for (var i = fields.length; --i >= 0;) {
+                       field = fields[i];
                        params[field] = this.dialog.find('itemId', field)[0].getValue();
-               }, this);
+               }
                this.search(params);
                return false;
        },
@@ -304,11 +305,13 @@ HTMLArea.FindReplace = Ext.extend(HTMLArea.Plugin, {
                if (this.matches == 0) {
                        var pattern = new RegExp(params.words ? '(?!<[^>]*)(\\b' + params.pattern + '\\b)(?![^<]*>)' : '(?!<[^>]*)(' + params.pattern + ')(?![^<]*>)', 'g' + (params.matchCase? '' : 'i'));
                        this.editor.setHTML(html.replace(pattern, '<span id="htmlarea-frmark">' + "$1" + '</span>'));
-                       Ext.each(this.editor.document.body.getElementsByTagName('span'), function (mark) {
+                       var spanElements = this.editor.document.body.getElementsByTagName('span');
+                       for (var i = 0, n = spanElements.length; i < n; i++) {
+                               var mark = spanElements[i];
                                if (/^htmlarea-frmark/.test(mark.id)) {
                                        this.spans.push(mark);
                                }
-                       }, this);
+                       }
                }
                this.spanWalker(params.pattern, params.replacement, params.replaceAll);
        },
@@ -324,7 +327,8 @@ HTMLArea.FindReplace = Ext.extend(HTMLArea.Plugin, {
        spanWalker: function (pattern, replacement, replaceAll) {
                this.clearMarks();
                if (this.spans.length) {
-                       Ext.each(this.spans, function (mark, i) {
+                       for (var i = 0, n = this.spans.length; i < n; i++) {
+                               var mark = this.spans[i];
                                if (i >= this.matches && !/[0-9]$/.test(mark.id)) {
                                        this.matches++;
                                        this.disableActions('clear', false);
@@ -344,7 +348,6 @@ HTMLArea.FindReplace = Ext.extend(HTMLArea.Plugin, {
                                        }
                                        if (replaceAll) {
                                                replace('yes');
-                                               return true;
                                        } else {
                                                TYPO3.Dialog.QuestionDialog({
                                                        title: this.getButton('FindReplace').tooltip.title,
@@ -352,10 +355,10 @@ HTMLArea.FindReplace = Ext.extend(HTMLArea.Plugin, {
                                                        fn: replace,
                                                        scope: this
                                                });
-                                               return false;
+                                               break;
                                        }
                                }
-                       }, this);
+                       }
                } else {
                        this.endWalk(pattern, 0);
                }
@@ -408,13 +411,15 @@ HTMLArea.FindReplace = Ext.extend(HTMLArea.Plugin, {
         * De-highlight all marks
         */
        clearMarks: function () {
-               Ext.each(this.editor.document.body.getElementsByTagName('span'), function (mark) {
+               var spanElements = this.editor.document.body.getElementsByTagName('span');
+               for (var i = spanElements.length; --i >= 0;) {
+                       var mark = spanElements[i];
                        if (/^htmlarea-frmark/.test(mark.id)) {
                                mark.style.backgroundColor = '';
                                mark.style.color = '';
                                mark.style.fontWeight = '';
                        }
-               }, this);
+               }
                this.disableActions('hiliteall', false);
                this.disableActions('clear', true);
        },
@@ -422,13 +427,15 @@ HTMLArea.FindReplace = Ext.extend(HTMLArea.Plugin, {
         * Highlight all marks
         */
        hiliteAll: function () {
-               Ext.each(this.editor.document.body.getElementsByTagName('span'), function (mark) {
+               var spanElements = this.editor.document.body.getElementsByTagName('span');
+               for (var i = spanElements.length; --i >= 0;) {
+                       var mark = spanElements[i];
                        if (/^htmlarea-frmark/.test(mark.id)) {
                                mark.style.backgroundColor = 'highlight';
                                mark.style.color = 'white';
                                mark.style.fontWeight = 'bold';
                        }
-               }, this);
+               }
                this.disableActions('clear', false);
                this.disableActions('hiliteall', true);
        },
@@ -443,16 +450,18 @@ HTMLArea.FindReplace = Ext.extend(HTMLArea.Plugin, {
                        this.disableActions('clear', true);
                }
        },
-       /*
+       /**
         * Disable action buttons
         *
-        * @param       array           actions: array of buttonIds to set disabled/enabled
-        * @param       boolean         disabled: true to set disabled
+        * @param string actions: comma-separated list of buttonIds to set disabled/enabled
+        * @param boolean disabled: true to set disabled
         */
        disableActions: function (actions, disabled) {
-               Ext.each(actions.split(/[,; ]+/), function (action) {
-                               this.dialog.find('itemId', action)[0].setDisabled(disabled);
-               }, this);
+               var buttonIds = actions.split(/[,; ]+/), action;
+               for (var i = buttonIds.length; --i >= 0;) {
+                       action = buttonIds[i];
+                       this.dialog.find('itemId', action)[0].setDisabled(disabled);
+               }
        },
        /*
         * Initialize find & replace variables
index d159a71..cf2526b 100644 (file)
@@ -74,9 +74,9 @@ HTMLArea.InlineElements = Ext.extend(HTMLArea.Plugin, {
                /*
                 * Registering the buttons
                 */
-               var n = this.buttonList.length;
-               for (var i = 0; i < n; ++i) {
-                       var button = this.buttonList[i];
+               var buttonList = this.buttonList, button, buttonId;
+               for (var i = 0, n = buttonList.length; i < n; ++i) {
+                       button = buttonList[i];
                        buttonId = button[0];
                        var buttonConfiguration = {
                                id              : buttonId,
@@ -91,6 +91,7 @@ HTMLArea.InlineElements = Ext.extend(HTMLArea.Plugin, {
                        };
                        this.registerButton(buttonConfiguration);
                }
+               return true;
        },
        /*
         * The list of buttons added by this plugin
@@ -360,14 +361,13 @@ HTMLArea.InlineElements = Ext.extend(HTMLArea.Plugin, {
                                        break;
                                default:
                                        var activeButton = false;
-                                       Ext.each(ancestors, function (ancestor) {
+                                       for (var i = ancestors.length; --i >= 0;) {
+                                               var ancestor = ancestors[i];
                                                if (ancestor && this.convertBtn[button.itemId] === ancestor.nodeName.toLowerCase()) {
                                                        activeButton = true;
-                                                       return false;
-                                               } else {
-                                                       return true;
+                                                       break;
                                                }
-                                       }, this);
+                                       }
                                        button.setInactive(!activeButton && this.convertBtn[button.itemId] !== tagName);
                                        button.setDisabled(disabled);
                                        break;
index 927b468..012514f 100644 (file)
@@ -34,19 +34,17 @@ HTMLArea.MicrodataSchema = Ext.extend(HTMLArea.Plugin, {
                /*
                 * Registering the buttons
                 */
-               var buttonList = this.buttonList, buttonId;
-               for (var i = 0, n = buttonList.length; i < n; ++i) {
-                       var button = buttonList[i];
-                       buttonId = button[0];
-                       var buttonConfiguration = {
-                               id              : buttonId,
-                               tooltip         : this.localize(buttonId + '-Tooltip'),
-                               iconCls         : 'htmlarea-action-' + button[2],
-                               action          : 'onButtonPress',
-                               context         : button[1]
-                       };
-                       this.registerButton(buttonConfiguration);
-               }
+               var button = this.buttonList[0];
+               var buttonId = button[0];
+               var buttonConfiguration = {
+                       id              : buttonId,
+                       tooltip         : this.localize(buttonId + '-Tooltip'),
+                       iconCls         : 'htmlarea-action-' + button[2],
+                       action          : 'onButtonPress',
+                       context         : button[1]
+               };
+               this.registerButton(buttonConfiguration);
+               return true;
        },
        /*
         * The list of buttons added by this plugin
@@ -327,7 +325,8 @@ HTMLArea.MicrodataSchema = Ext.extend(HTMLArea.Plugin, {
        setMicrodataAttributes: function (element) {
                if (this.fieldset) {
                        var comboFields = this.fieldset.findByType('combo');
-                       Ext.each(comboFields, function (field) {
+                       for (var i = comboFields.length; --i >= 0;) {
+                               var field = comboFields[i];
                                var itemId = field.getItemId();
                                var value = field.getValue();
                                switch (itemId) {
@@ -336,7 +335,7 @@ HTMLArea.MicrodataSchema = Ext.extend(HTMLArea.Plugin, {
                                                element.setAttribute(itemId, (value === 'none') ? '' : value);
                                                break;
                                }
-                       }, this);
+                       }
                        var itemScopeField = this.fieldset.find('itemId', 'itemscope')[0];
                        if (itemScopeField) {
                                if (itemScopeField.getValue()) {
index 9352866..e47904f 100644 (file)
@@ -35,7 +35,8 @@ HTMLArea.PlainText = Ext.extend(HTMLArea.Plugin, {
                /*
                 * Registering the buttons
                 */
-               Ext.iterate(this.buttonList, function (buttonId, buttonConf) {
+               for (var buttonId in this.buttonList) {
+                       var buttonConf = this.buttonList[buttonId];
                        var buttonConfiguration = {
                                id              : buttonId,
                                tooltip         : this.localize(buttonId + 'Tooltip'),
@@ -50,7 +51,7 @@ HTMLArea.PlainText = Ext.extend(HTMLArea.Plugin, {
                                this.buttonsConfiguration[buttonConf[0]].hotKey = null;
                        }
                        this.registerButton(buttonConfiguration);
-               }, this);
+               }
                return true;
        },
        /*
@@ -82,7 +83,7 @@ HTMLArea.PlainText = Ext.extend(HTMLArea.Plugin, {
                        this.pasteBehaviourConfiguration = this.buttonsConfiguration['pastebehaviour'];
                }
                this.cleaners = {};
-               Ext.iterate(this.cleanerConfig, function (behaviour) {
+               for (var behaviour in this.cleanerConfig) {
                        if (this.pasteBehaviourConfiguration && this.pasteBehaviourConfiguration[behaviour]) {
                                if (this.pasteBehaviourConfiguration[behaviour].keepTags) {
                                        this.cleanerConfig[behaviour].keepTags = new RegExp( '^(' + this.pasteBehaviourConfiguration[behaviour].keepTags.split(',').join('|') + ')$', 'i');
@@ -92,7 +93,7 @@ HTMLArea.PlainText = Ext.extend(HTMLArea.Plugin, {
                                }
                        }
                        this.cleaners[behaviour] = new HTMLArea.DOM.Walker(this.cleanerConfig[behaviour]);
-               }, this);
+               }
                        // Initial behaviour
                this.currentBehaviour = 'plainText';
                        // May be set in TYPO3 User Settings
@@ -214,13 +215,14 @@ HTMLArea.PlainText = Ext.extend(HTMLArea.Plugin, {
                        'plainText',
                        'pasteStructure',
                        'pasteFormat'
-               ];
-               Ext.each(fields, function (field) {
+               ], field;
+               for (var i = fields.length; --i >= 0;) {
+                       field = fields[i];
                        if (this.dialog.find('itemId', field)[0].getValue()) {
                                this.currentBehaviour = field;
-                               return false;
+                               break;
                        }
-               }, this);
+               }
                this.close();
                return false;
        },
index dc31fff..9f8f6b6 100644 (file)
@@ -220,7 +220,8 @@ HTMLArea.QuickTag = Ext.extend(HTMLArea.Plugin, {
                this.parseCssRule(this.editor.document.styleSheets, valueStore);
        },
        parseCssRule: function (rules, valueStore) {
-               Ext.each(rules, function (rule) {
+               for (var i = 0, n = rules.length; i < n; i++) {
+                       var rule = rules[i];
                        if (rule.selectorText) {
                                if (/^(\w*)\.(\w+)$/.test(rule.selectorText)) {
                                        valueStore.add(new this.valueRecord({
@@ -237,6 +238,8 @@ HTMLArea.QuickTag = Ext.extend(HTMLArea.Plugin, {
                                        } catch (e) {
                                                if (/Security/i.test(e)) {
                                                        this.appendToLog('parseCssRule', 'A security error occurred. Make sure all stylesheets are accessed from the same domain/subdomain and using the same protocol as the current script.', 'error');
+                                               } else {
+                                                       throw e;
                                                }
                                        }
                                }
@@ -252,7 +255,7 @@ HTMLArea.QuickTag = Ext.extend(HTMLArea.Plugin, {
                                        this.parseCssRule(rule.rules, valueStore);
                                }
                        }
-               }, this);
+               }
        },
        /*
         * Handler invoked when a tag is selected
index 646c5c5..ae838b6 100644 (file)
@@ -165,11 +165,12 @@ HTMLArea.RemoveFormat = Ext.extend(HTMLArea.Plugin, {
                        'spaces',
                        'images',
                        'allHtml'
-               ];
+               ], field;
                var params = {};
-               Ext.each(fields, function (field) {
+               for (var i = fields.length; --i >= 0;) {
+                       field = fields[i];
                        params[field] = this.dialog.find('itemId', field)[0].getValue();
-               }, this);
+               }
                if (params['allHtml'] || params['formatting'] || params['spaces'] || params['images'] || params['msWordFormatting'] || params['typographical']) {
                        this.applyRequest(params);
                        this.close();
index 3b5be01..eb2611b 100644 (file)
@@ -56,8 +56,10 @@ HTMLArea.SelectFont = Ext.extend(HTMLArea.Plugin, {
                /*
                 * Registering the dropdowns
                 */
-               Ext.each(this.dropDownList, function (dropDown) {
-                       var buttonId = dropDown[0];
+               var dropDown, buttonId;
+               for (var i = this.dropDownList.length; --i >= 0;) {
+                       dropDown = this.dropDownList[i];
+                       buttonId = dropDown[0];
                        if (this.isButtonInToolbar(buttonId)) {
                                var dropDownConfiguration = {
                                        id: buttonId,
@@ -79,8 +81,7 @@ HTMLArea.SelectFont = Ext.extend(HTMLArea.Plugin, {
                                }
                                this.registerDropDown(dropDownConfiguration);
                        }
-                       return true;
-               }, this);
+               }
                return true;
         },
        /*
@@ -104,12 +105,14 @@ HTMLArea.SelectFont = Ext.extend(HTMLArea.Plugin, {
                FontName: 'font-family',
                FontSize: 'font-size'
        },
-       /*
+       /**
         * This funcion is invoked by the editor when it is being generated
         */
        onGenerate: function () {
-                       // Monitor the dropdowns stores being loaded
-               Ext.each(this.dropDownList, function (dropDown) {
+               // Monitor the dropdowns stores being loaded
+               var dropDown;
+               for (var i = this.dropDownList.length; --i >= 0;) {
+                       dropDown = this.dropDownList[i];
                        var select = this.getButton(dropDown[0]);
                        if (select) {
                                select.mon(select.getStore(), 'load', function () {
@@ -120,7 +123,7 @@ HTMLArea.SelectFont = Ext.extend(HTMLArea.Plugin, {
                                        this.onUpdateToolbar(select, this.getEditorMode(), selectionEmpty, ancestors, endPointsInSameBlock);
                                }, this);
                        }
-               }, this);
+               }
        },
        /*
         * This function gets called when some font style or font size was selected from the dropdown lists
index 0c9089a..6bc333c 100644 (file)
@@ -51,6 +51,7 @@ HTMLArea.SpellChecker = Ext.extend(HTMLArea.Plugin, {
                        dialog          : true
                };
                this.registerButton(buttonConfiguration);
+               return true;
        },
        /*
         * Sets of default configuration values for dialogue form fields
@@ -403,13 +404,17 @@ HTMLArea.SpellChecker = Ext.extend(HTMLArea.Plugin, {
                                pspell_charset: this.contentCharset,
                                pspell_mode: this.spellCheckerMode
                        };
-                       Ext.each(this.addToPersonalDictionary, function (word, index) {
+                       var word;
+                       for (var index = this.addToPersonalDictionary.length; --index >= 0;) {
+                               word = this.addToPersonalDictionary[index];
                                data['to_p_dict[' + index + ']'] = word;
-                       });
-                       Ext.each(this.addToReplacementList, function (replacement, index) {
+                       }
+                       var replacement;
+                       for (var index = this.addToReplacementList.length; --index >= 0;) {
+                               replacement = this.addToReplacementList[index];
                                data['to_r_list[' + index + '][0]'] = replacement[0];
                                data['to_r_list[' + index + '][1]'] = replacement[1];
-                       });
+                       }
                        this.postData(this.pageTSconfiguration.path, data);
                }
                this.close();
@@ -447,7 +452,7 @@ HTMLArea.SpellChecker = Ext.extend(HTMLArea.Plugin, {
                this.statusIconClass = iconCls;
                this.status.addClass(this.statusIconClass);
        },
-       /*
+       /**
         * Clean away span elements from the text before leaving or re-submitting
         *
         * @param       boolean         leaveFixed: if true, span elements of corrected words will be left in the text (re-submit case)
@@ -456,7 +461,9 @@ HTMLArea.SpellChecker = Ext.extend(HTMLArea.Plugin, {
         */
        cleanDocument: function (leaveFixed) {
                var iframeDocument = this.dialog.getComponent('spell-check-iframe').getEl().dom.contentWindow.document;
-               Ext.each(this.misspelledWords.concat(this.correctedWords), function (element) {
+               var spanElements = this.misspelledWords.concat(this.correctedWords);
+               for (var i = spanElements.length; --i >= 0;) {
+                       var element = spanElements[i];
                        element.onclick = null;
                        element.onmouseover = null;
                        element.onmouseout = null;
@@ -468,11 +475,13 @@ HTMLArea.SpellChecker = Ext.extend(HTMLArea.Plugin, {
                                HTMLArea.DOM.removeClass(element, 'htmlarea-spellcheck-same');
                                HTMLArea.DOM.removeClass(element, 'htmlarea-spellcheck-current');
                        }
-               }, this);
-                       // Cleanup event handlers on links
-               Ext.each(iframeDocument.getElementsByTagName('a'), function (link) {
+               }
+               // Cleanup event handlers on links
+               var linkElements = iframeDocument.getElementsByTagName('a');
+               for (var i = linkElements.length; --i >= 0;) {
+                       var link = linkElements[i];
                        link.onclick = null;
-               }, this);
+               }
                return this.editor.iframe.htmlRenderer.render(iframeDocument.body, false);
        },
        /*
@@ -492,10 +501,12 @@ HTMLArea.SpellChecker = Ext.extend(HTMLArea.Plugin, {
                        // Set status
                this.status.setText(this.localize('statusBarReady'));
                this.setStatusIconClass('status-ready');
-                       // Process all misspelled words
+               // Process all misspelled words
                var id = 0;
                var self = this;
-               Ext.each(contentWindow.document.getElementsByTagName('span'), function (span) {
+               var spanElements = contentWindow.document.getElementsByTagName('span');
+               for (var i = spanElements.length; --i >= 0;) {
+                       var span = spanElements[i];
                        if (HTMLArea.DOM.hasClass(span, 'htmlarea-spellcheck-error')) {
                                this.misspelledWords.push(span);
                                span.onclick = function (event) { self.setCurrentWord(this, false); };
@@ -511,18 +522,24 @@ HTMLArea.SpellChecker = Ext.extend(HTMLArea.Plugin, {
                        } else if (HTMLArea.DOM.hasClass(span, 'htmlarea-spellcheck-fixed')) {
                                this.correctedWords.push(span);
                        }
-               }, this);
-                       // Do not open links in the iframe
-               Ext.each(contentWindow.document.getElementsByTagName('a'), function (link) {
+               }
+               // Do not open links in the iframe
+               var linkElements = contentWindow.document.getElementsByTagName('a');
+               for (var i = linkElements.length; --i >= 0;) {
+                       var link = linkElements[i];
                        link.onclick = function (event) { return false; };
-               }, this);
-                       // Enable buttons
-               Ext.each(this.dialog.findByType('button'), function (button) {
+               }
+               // Enable buttons
+               var buttons = this.dialog.findByType('button');
+               for (var i = buttons.length; --i >= 0;) {
+                       var button = buttons[i];
                        button.setDisabled(false);
-               });
-               Ext.each(this.dialog.getBottomToolbar().findByType('button'), function (button) {
+               }
+               var buttons = this.dialog.getBottomToolbar().findByType('button');
+               for (var i = buttons.length; --i >= 0;) {
+                       var button = buttons[i];
                        button.setDisabled(false);
-               });
+               }
                if (this.misspelledWords.length) {
                                // Set current element to first misspelled word
                        this.currentElement = this.misspelledWords[0];
@@ -533,12 +550,14 @@ HTMLArea.SpellChecker = Ext.extend(HTMLArea.Plugin, {
                                var select = this.dialog.find('itemId', 'dictionaries')[0];
                                var store = select.getStore();
                                store.removeAll();
-                               Ext.each(dictionaries, function (dictionary) {
+                               var dictionary;
+                               for (var i = dictionaries.length; --i >= 0;) {
+                                       dictionary = dictionaries[i];
                                        store.add(new store.recordType({
                                                text: dictionary,
                                                value: dictionary
                                        }));
-                               });
+                               }
                                select.setValue(contentWindow.selectedDictionary);
                                var selectedIndex = store.find('value', contentWindow.selectedDictionary);
                                select.fireEvent('select', select, store.getAt(selectedIndex), selectedIndex);
@@ -600,19 +619,22 @@ HTMLArea.SpellChecker = Ext.extend(HTMLArea.Plugin, {
                        // De-highlight all occurrences of current word
                if (this.currentElement) {
                        HTMLArea.DOM.removeClass(this.currentElement, 'htmlarea-spellcheck-current');
-                       Ext.each(this.allWords[this.currentElement.htmlareaOriginalWord], function (word) {
+                       var occurrences = this.allWords[this.currentElement.htmlareaOriginalWord];
+                       for (var i = occurrences.length; --i >= 0;) {
+                               var word = occurrences[i];
                                HTMLArea.DOM.removeClass(word, 'htmlarea-spellcheck-same');
-                       });
+                       }
                }
                        // Highlight all occurrences of new current word
                this.currentElement = element;
                HTMLArea.DOM.addClass(this.currentElement, 'htmlarea-spellcheck-current');
                var occurrences = this.allWords[this.currentElement.htmlareaOriginalWord];
-               Ext.each(occurrences, function (word) {
+               for (var i = occurrences.length; --i >= 0;) {
+                       var word = occurrences[i];
                        if (word != this.currentElement) {
                                HTMLArea.DOM.addClass(word, 'htmlarea-spellcheck-same');
                        }
-               }, this);
+               }
                this.dialog.find('itemId', 'replaceAll')[0].setDisabled(occurrences.length <= 1);
                this.dialog.find('itemId', 'ignoreAll')[0].setDisabled(occurrences.length <= 1);
                        // Display status
@@ -640,12 +662,14 @@ HTMLArea.SpellChecker = Ext.extend(HTMLArea.Plugin, {
                var select = this.dialog.find('itemId', 'suggestions')[0];
                var store = select.getStore();
                store.removeAll();
-               Ext.each(suggestions, function (suggestion) {
+               var suggestion;
+               for (var i = suggestions.length; --i >= 0;) {
+                       suggestion = suggestions[i];
                        store.add(new store.recordType({
                                text: suggestion,
                                value: suggestion
                        }));
-               });
+               }
                        // Update the current word
                this.dialog.find('itemId', 'word')[0].setValue(this.currentElement.htmlareaOriginalWord);
                if (suggestions.length > 0) {
@@ -728,16 +752,18 @@ HTMLArea.SpellChecker = Ext.extend(HTMLArea.Plugin, {
                this.setCurrentWord(this.misspelledWords[index], true);
                return false;
        },
-       /*
+       /**
         * Handler invoked when the Replace all button is clicked
         */
        onReplaceAllClick: function () {
-               Ext.each(this.allWords[this.currentElement.htmlareaOriginalWord], function (element) {
+               var words = this.allWords[this.currentElement.htmlareaOriginalWord];
+               for (var i = words.length; --i >= 0;) {
+                       var element = words[i];         
                        if (element != this.currentElement) {
                                this.replaceWord(element);
                        }
-               }, this);
-                       // Replace current element last, so that we jump to the next word
+               }
+               // Replace current element last, so that we jump to the next word
                return this.onReplaceClick();
        },
        /*
@@ -765,13 +791,17 @@ HTMLArea.SpellChecker = Ext.extend(HTMLArea.Plugin, {
         * Handler invoked when the Re-check button is clicked
         */
        onRecheckClick: function () {
-                       // Disable buttons
-               Ext.each(this.dialog.findByType('button'), function (button) {
+               // Disable buttons
+               var buttons = this.dialog.findByType('button');
+               for (var i = buttons.length; --i >= 0;) {
+                       var button = buttons[i];
                        button.setDisabled(true);
-               });
-               Ext.each(this.dialog.getBottomToolbar().findByType('button'), function (button) {
+               }
+               var buttons = this.dialog.getBottomToolbar().findByType('button');
+               for (var i = buttons.length; --i >= 0;) {
+                       var button = buttons[i];
                        button.setDisabled(true);
-               });
+               }
                this.status.setText(this.localize('Please wait: changing dictionary to') + ': "' + this.dialog.find('itemId', 'dictionary')[0].getValue() + '".');
                this.setStatusIconClass('status-wait');
                this.dialog.find('itemId', 'content')[0].setValue(this.cleanDocument(true));
@@ -789,9 +819,9 @@ HTMLArea.SpellChecker = Ext.extend(HTMLArea.Plugin, {
                        });
                } else {
                        var txt = '';
-                       Ext.iterate(info, function (key, value) {
-                               txt += (txt ? '<br />' : '') + this.localize(key) + ': ' + value;
-                       }, this);
+                       for (var key in info) {
+                               txt += (txt ? '<br />' : '') + this.localize(key) + ': ' + info[key];
+                       }
                        txt += ' ' + this.localize('seconds');
                        TYPO3.Dialog.InformationDialog({
                                title: this.localize('Document information'),
index a73e3f3..b9c0989 100644 (file)
@@ -63,9 +63,9 @@ HTMLArea.TableOperations = Ext.extend(HTMLArea.Plugin, {
                 * Registering the buttons
                 */
                var hideToggleBorders = this.editorConfiguration.hideTableOperationsInToolbar && !(this.buttonsConfiguration.toggleborders && this.buttonsConfiguration.toggleborders.keepInToolbar);
-               var buttonList = this.buttonList, buttonId;
+               var buttonList = this.buttonList, button, buttonId;
                for (var i = 0, n = buttonList.length; i < n; ++i) {
-                       var button = buttonList[i];
+                       button = buttonList[i];
                        buttonId = (button[0] === 'InsertTable') ? button[0] : ('TO-' + button[0]);
                        var buttonConfiguration = {
                                id              : buttonId,
@@ -364,7 +364,7 @@ HTMLArea.TableOperations = Ext.extend(HTMLArea.Plugin, {
                                        f_caption: 'caption',
                                        f_summary: 'summary'
                                };
-                               Ext.iterate(required, function (item) {
+                               for (var item in required) {
                                        if (!params[item] && this.properties.required.indexOf(required[item]) != -1) {
                                                TYPO3.Dialog.ErrorDialog({
                                                        title: this.getButton(this.dialog.arguments.buttonId).tooltip.title,
@@ -375,9 +375,9 @@ HTMLArea.TableOperations = Ext.extend(HTMLArea.Plugin, {
                                                tab.ownerCt.activate(tab);
                                                field.focus();
                                                errorFlag = true;
-                                               return false;
+                                               break;
                                        }
-                               }, this);
+                               }
                                if (errorFlag) {
                                        return false;
                                }
@@ -389,7 +389,7 @@ HTMLArea.TableOperations = Ext.extend(HTMLArea.Plugin, {
                                f_rows: 'You must enter a number of rows',
                                f_cols: 'You must enter a number of columns'
                        };
-                       Ext.iterate(required, function (item) {
+                       for (var item in required) {
                                if (!params[item]) {
                                        TYPO3.Dialog.ErrorDialog({
                                                title: this.getButton(this.dialog.arguments.buttonId).tooltip.title,
@@ -400,9 +400,9 @@ HTMLArea.TableOperations = Ext.extend(HTMLArea.Plugin, {
                                        tab.ownerCt.activate(tab);
                                        field.focus();
                                        errorFlag = true;
-                                       return false;
+                                       break;
                                }
-                       }, this);
+                       }
                        if (errorFlag) {
                                return false;
                        }
@@ -426,7 +426,7 @@ HTMLArea.TableOperations = Ext.extend(HTMLArea.Plugin, {
                this.setHeaders(table, params);
                this.processStyle(table, params);
                table.removeAttribute('border');
-               Ext.iterate(params, function (item) {
+               for (var item in params) {
                        var val = params[item];
                        switch (item) {
                            case "f_caption":
@@ -516,7 +516,7 @@ HTMLArea.TableOperations = Ext.extend(HTMLArea.Plugin, {
                                table.dir = (val != "not set") ? val : "";
                                break;
                        }
-               }, this);
+               }
                if (this.dialog.arguments.buttonId === "InsertTable") {
                        if (!HTMLArea.isIEBeforeIE9) {
                                this.editor.getSelection().insertNode(table);
@@ -558,9 +558,10 @@ HTMLArea.TableOperations = Ext.extend(HTMLArea.Plugin, {
                } else {
                        elements.push(this.dialog.arguments.element);
                }
-               Ext.each(elements, function (element) {
+               for (var i = elements.length; --i >= 0;) {
+                       var element = elements[i];
                        this.processStyle(element, params);
-                       Ext.iterate(params, function (item) {
+                       for (var item in params) {
                                var val = params[item];
                                switch (item) {
                                    case "f_cell_type":
@@ -610,8 +611,8 @@ HTMLArea.TableOperations = Ext.extend(HTMLArea.Plugin, {
                                        element.dir = (val != "not set") ? val : "";
                                        break;
                                }
-                       }, this);
-               }, this);
+                       }
+               }
                this.reStyleTable(table);
                this.close();
        },
@@ -2123,13 +2124,12 @@ HTMLArea.TableOperations = Ext.extend(HTMLArea.Plugin, {
                var selectedTextAlign = 'not set';
                var blockElements = this.getPluginInstance('BlockElements');
                if (element && blockElements) {
-                       Ext.iterate(this.convertAlignment, function (value) {
+                       for (var value in this.convertAlignment) {
                                if (Ext.get(element).hasClass(blockElements.useClass[this.convertAlignment[value]])) {
                                        selectedTextAlign = value;
-                                       return false;
+                                       break;
                                }
-                               return true;
-                       }, this);
+                       }
                } else {
                        selectedTextAlign = (element && element.style.textAlign) ? element.style.textAlign : 'not set';
                }
@@ -2565,13 +2565,13 @@ HTMLArea.TableOperations = Ext.extend(HTMLArea.Plugin, {
                if (this.properties[property] && this.properties[property].removeItems) {
                        var items = this.properties[property].removeItems.split(',');
                        var index = -1;
-                       Ext.each(items, function (item) {
+                       for (var i = items.length; --i >= 0;) {
+                               var item = items[i];
                                index = store.findExact('value', item.trim());
                                if (index !== -1) {
                                        store.removeAt(index);
                                }
-                               return true;
-                       });
+                       }
                }
        },
        /*
index 7d210a8..a7e7853 100644 (file)
@@ -312,13 +312,13 @@ HTMLArea.TextStyle = Ext.extend(HTMLArea.Plugin, {
                                        allowedClasses = this.cssArray['all'];
                                }
                        }
-                       Ext.iterate(allowedClasses, function (cssClass, value) {
+                       for (var cssClass in allowedClasses) {
                                store.add(new store.recordType({
-                                       text: value,
+                                       text: allowedClasses[cssClass],
                                        value: cssClass,
                                        style: (!(this.pageTSconfiguration && this.pageTSconfiguration.disableStyleOnOptionLabel) && HTMLArea.classesValues && HTMLArea.classesValues[cssClass] && !HTMLArea.classesNoShow[cssClass]) ? HTMLArea.classesValues[cssClass] : null
                                }));
-                       }, this);
+                       }
                }
        },
        /*