Fixed issue #10834: htmlArea RTE: IE8 now uses standard name for DOM class attribute
authorStanislas Rolland <typo3@sjbr.ca>
Fri, 3 Apr 2009 00:14:53 +0000 (00:14 +0000)
committerStanislas Rolland <typo3@sjbr.ca>
Fri, 3 Apr 2009 00:14:53 +0000 (00:14 +0000)
git-svn-id: https://svn.typo3.org/TYPO3v4/Core/branches/TYPO3_4-2@5260 709f56b5-9817-0410-a4d7-c38de5d9e867

ChangeLog
typo3/sysext/rtehtmlarea/ChangeLog
typo3/sysext/rtehtmlarea/htmlarea/htmlarea.js
typo3/sysext/rtehtmlarea/htmlarea/plugins/BlockElements/block-elements.js
typo3/sysext/rtehtmlarea/htmlarea/plugins/InlineElements/inline-elements.js
typo3/sysext/rtehtmlarea/htmlarea/plugins/TableOperations/table-operations.js

index 9ba33fd..d1149ef 100755 (executable)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2009-04-02  Stanislas Rolland  <typo3@sjbr.ca>
+
+       * Fixed issue #10834: htmlArea RTE: IE8 now uses standard name for DOM class attribute
+
 2009-03-31  Benjamin Mack  <benni@typo3.org>
 
        * Fixed bug #10567: Added IE8+ support / Get rid of browser version dependent t3lib_div::clientInfo() (Thanks to Steffen Gebert)
index 20d6ba1..d26ac9f 100644 (file)
@@ -1,3 +1,7 @@
+2009-04-02  Stanislas Rolland  <typo3@sjbr.ca>
+
+       * Fixed issue #10834: htmlArea RTE: IE8 now uses standard name for DOM class attribute
+
 2009-03-10  Stanislas Rolland  <typo3@sjbr.ca>
 
        * Fixed issue #10656: htmlArea RTE: Initialization fails in presence of Firefox extension Ant.com Toolbar 1.3
index 9b899ce..5a2cea2 100644 (file)
@@ -2332,9 +2332,14 @@ HTMLArea._removeClass = function(el, removeClassName) {
                if (cls[--i] != removeClassName) ar[ar.length] = cls[i];
        }
        if (ar.length == 0) {
-               if (!HTMLArea.is_opera) el.removeAttribute(HTMLArea.is_gecko ? "class" : "className");
-                       else el.className = '';
-
+               if (!HTMLArea.is_opera) {
+                       el.removeAttribute("class");
+                       if (HTMLArea.is_ie) {
+                               el.removeAttribute("className");
+                       }
+               } else {
+                       el.className = '';
+               }
        } else el.className = ar.join(" ");
 };
 
index babc5c1..7e721bf 100644 (file)
@@ -69,7 +69,10 @@ BlockElements = HTMLArea.Plugin.extend({
                                }
                        }
                }
-               this.allowedAttributes = new Array("id", "title", "lang", "xml:lang", "dir", (HTMLArea.is_gecko?"class":"className"));
+               this.allowedAttributes = new Array("id", "title", "lang", "xml:lang", "dir", "class");
+               if (HTMLArea.is_ie) {
+                       this.allowedAttributes.push("className");
+               }
                this.indentedList = null;
                
                /*
index 78bcf02..506cb0d 100644 (file)
@@ -44,9 +44,11 @@ InlineElements = HTMLArea.Plugin.extend({
         * This function gets called by the base constructor
         */
        configurePlugin : function (editor) {
-               
-               this.allowedAttributes = new Array("id", "title", "lang", "xml:lang", "dir", (HTMLArea.is_gecko?"class":"className"));
-               
+               this.allowedAttributes = new Array("id", "title", "lang", "xml:lang", "dir", "class");
+               if (HTMLArea.is_ie) {
+                       this.allowedAttributes.push("className");
+               }
+
                if (this.editorConfiguration.buttons.textstyle) {
                        this.tags = this.editorConfiguration.buttons.textstyle.tags;
                }
@@ -393,7 +395,23 @@ InlineElements = HTMLArea.Plugin.extend({
                                newElement.setAttribute(this.allowedAttributes[i], attributeValue);
                        }
                }
-               
+                       // In IE, the above fails to update the class and style attributes.
+               if (HTMLArea.is_ie) {
+                       if (element.style.cssText) {
+                               newElement.style.cssText = element.style.cssText;
+                       }
+                       if (element.className) {
+                               newElement.setAttribute("class", element.className);
+                               if (!newElement.className) {
+                                               // IE before IE8
+                                       newElement.setAttribute("className", element.className);
+                               }
+                       } else {
+                               newElement.removeAttribute("class");
+                                       // IE before IE8
+                               newElement.removeAttribute("className");
+                       }
+               }
                if (this.tags && this.tags[tagName] && this.tags[tagName].allowedClasses) {
                        if (newElement.className && /\S/.test(newElement.className)) {
                                var allowedClasses = this.tags[tagName].allowedClasses;
index f847805..b13e492 100644 (file)
@@ -1224,12 +1224,17 @@ TableOperations = HTMLArea.Plugin.extend({
                                newCell.style.cssText = element.style.cssText;
                        }
                        if (element.className) {
-                               newCell.setAttribute("className", element.className);
+                               newCell.setAttribute("class", element.className);
+                               if (!newCell.className) {
+                                               // IE before IE8
+                                       newCell.setAttribute("className", element.className);
+                               }
                        } else {
+                               newCell.removeAttribute("class");
+                                       // IE before IE8
                                newCell.removeAttribute("className");
                        }
                }
-               
                if (this.tags && this.tags[nodeName] && this.tags[nodeName].allowedClasses) {
                        if (newCell.className && /\S/.test(newCell.className)) {
                                var allowedClasses = this.tags[nodeName].allowedClasses;