[BUGFIX] RTE: Edit element dialogue may raise JavaScript error 74/33374/2
authorStanislas Rolland <typo3@sjbr.ca>
Fri, 17 Oct 2014 18:44:33 +0000 (14:44 -0400)
committerStanislas Rolland <typo3@sjbr.ca>
Fri, 17 Oct 2014 20:08:05 +0000 (22:08 +0200)
When clicking ok, some tabs may have not been rendered. Check for
presence of elements and values.

Releases: master, 6.2
Resolves: #62314
Change-Id: I928ac7ce8bebe2539f49e2153b4f7f8f2f7c889b
Reviewed-on: http://review.typo3.org/33373
Reviewed-by: Stanislas Rolland <typo3@sjbr.ca>
Tested-by: Stanislas Rolland <typo3@sjbr.ca>
(cherry picked from commit bb0cfc607a7a3235f783e46606d1c6e5a32f6f2e)
Reviewed-on: http://review.typo3.org/33374

typo3/sysext/rtehtmlarea/htmlarea/plugins/EditElement/edit-element.js
typo3/sysext/rtehtmlarea/htmlarea/plugins/MicrodataSchema/microdata-schema.js

index e277bf6..87aacb8 100644 (file)
@@ -424,7 +424,11 @@ HTMLArea.EditElement = Ext.extend(HTMLArea.Plugin, {
                var textFields = this.dialog.findByType('textfield');
                Ext.each(textFields, function (field) {
                        if (field.getXType() !== 'combo') {
-                               this.element.setAttribute(field.getItemId(), field.getValue());
+                               if (field.getValue()) {
+                                       this.element.setAttribute(field.getItemId(), field.getValue());
+                               } else {
+                                       this.element.removeAttribute(field.getItemId());
+                               }
                        }
                }, this);
                var comboFields = this.dialog.findByType('combo');
index c885c85..927b468 100644 (file)
@@ -325,23 +325,27 @@ HTMLArea.MicrodataSchema = Ext.extend(HTMLArea.Plugin, {
         * Set microdata attributes of the element
         */
        setMicrodataAttributes: function (element) {
-               var comboFields = this.fieldset.findByType('combo');
-               Ext.each(comboFields, function (field) {
-                       var itemId = field.getItemId();
-                       var value = field.getValue();
-                       switch (itemId) {
-                               case 'itemprop':
-                               case 'itemtype':
-                                       element.setAttribute(itemId, (value === 'none') ? '' : value);
-                                       break;
+               if (this.fieldset) {
+                       var comboFields = this.fieldset.findByType('combo');
+                       Ext.each(comboFields, function (field) {
+                               var itemId = field.getItemId();
+                               var value = field.getValue();
+                               switch (itemId) {
+                                       case 'itemprop':
+                                       case 'itemtype':
+                                               element.setAttribute(itemId, (value === 'none') ? '' : value);
+                                               break;
+                               }
+                       }, this);
+                       var itemScopeField = this.fieldset.find('itemId', 'itemscope')[0];
+                       if (itemScopeField) {
+                               if (itemScopeField.getValue()) {
+                                       element.setAttribute('itemscope', 'itemscope');
+                               } else {
+                                       element.removeAttribute('itemscope');
+                                       element.removeAttribute('itemtype');
+                               }
                        }
-               }, this);
-               var itemScopeField = this.fieldset.find('itemId', 'itemscope')[0];
-               if (itemScopeField.getValue()) {
-                       element.setAttribute('itemscope', 'itemscope');
-               } else {
-                       element.removeAttribute('itemscope');
-                       element.removeAttribute('itemtype');
                }
        },
        /*