Fixed issue #10834: htmlArea RTE: IE8 now uses standard name for DOM class attribute
authorStanislas Rolland <typo3@sjbr.ca>
Fri, 3 Apr 2009 00:09:19 +0000 (00:09 +0000)
committerStanislas Rolland <typo3@sjbr.ca>
Fri, 3 Apr 2009 00:09:19 +0000 (00:09 +0000)
git-svn-id: https://svn.typo3.org/TYPO3v4/Core/trunk@5259 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/DefinitionList/definition-list.js
typo3/sysext/rtehtmlarea/htmlarea/plugins/InlineElements/inline-elements.js
typo3/sysext/rtehtmlarea/htmlarea/plugins/Language/language.js
typo3/sysext/rtehtmlarea/htmlarea/plugins/SelectFont/select-font.js
typo3/sysext/rtehtmlarea/htmlarea/plugins/TYPO3Color/typo3color.js
typo3/sysext/rtehtmlarea/htmlarea/plugins/TableOperations/table-operations.js
typo3/sysext/rtehtmlarea/htmlarea/plugins/TextStyle/text-style.js

index a043bf5..6fd298a 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-04-01  Steffen Kamper  <info@sk-typo3.de>
 
        * FollowUp #10025: ImageMagick generates larger than necessary files: identify doesn't work with the 'profile'-parameter
index 1c111f1..1620a6c 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-12  Stanislas Rolland  <typo3@sjbr.ca>
 
        * Added feature #10670: htmlArea RTE: enable alternate rendering of image click enlarge by FE plugins
index 8412e94..0d407dc 100644 (file)
@@ -2087,8 +2087,14 @@ HTMLArea._removeClass = function(el, className, substring) {
                }
        }
        if (newClasses.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 = newClasses.join(" ");
        }
index 456a1d2..c73de9c 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.addAllowedAttribute("className");
+               }
                this.indentedList = null;
                
                /*
@@ -191,7 +194,7 @@ BlockElements = HTMLArea.Plugin.extend({
        },
        
        /*
-        * This function adds an attribute to the array of allowed attributes on inline elements
+        * This function adds an attribute to the array of attributes allowed on block elements
         *
         * @param       string  attribute: the name of the attribute to be added to the array
         *
index 64b6742..1190225 100644 (file)
@@ -169,8 +169,13 @@ DefinitionList = BlockElements.extend({
                                newNode.style.cssText = node.style.cssText;
                        }
                        if (node.className) {
-                               newNode.setAttribute("className", node.className);
+                               newNode.setAttribute("class", node.className);
+                               if (!newNode.className) {
+                                               // IE before IE8
+                                       newNode.setAttribute("className", node.className);
+                               }
                        } else {
+                               newNode.removeAttribute("class");
                                newNode.removeAttribute("className");
                        }
                }
index 5919ef4..40432cf 100644 (file)
@@ -49,7 +49,10 @@ InlineElements = HTMLArea.Plugin.extend({
                if (this.editor.plugins.TextStyle && this.editor.plugins.TextStyle.instance) {
                        this.allowedAttributes = this.editor.plugins.TextStyle.instance.allowedAttributes;
                } else {
-                       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.addAllowedAttribute("className");
+                       }
                }
                        // Getting tags configuration for inline elements
                if (this.editorConfiguration.buttons.textstyle) {
@@ -336,6 +339,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)) {
index 697bfee..d0f7cfc 100644 (file)
@@ -62,7 +62,10 @@ Language = HTMLArea.Plugin.extend({
                        this.allowedAttributes = this.editor.getPluginInstance("BlockElements").allowedAttributes;
                }
                if (!this.allowedAttributes) {
-                       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");
+                       }
                }
 
                /*
index ba720fc..8ed35b3 100644 (file)
@@ -71,7 +71,10 @@ SelectFont = HTMLArea.Plugin.extend({
                        this.editor.getPluginInstance("BlockElements").addAllowedAttribute("style");
                }
                if (!this.allowedAttributes) {
-                       this.allowedAttributes = new Array("id", "title", "lang", "xml:lang", "dir", (HTMLArea.is_gecko?"class":"className"), "style");
+                       this.allowedAttributes = new Array("id", "title", "lang", "xml:lang", "dir", "class", "style");
+                       if (HTMLArea.is_ie) {
+                               this.allowedAttributes.push("className");
+                       }
                }
 
                /*
index b12c8ba..1397ed6 100644 (file)
@@ -59,7 +59,10 @@ TYPO3Color = HTMLArea.Plugin.extend({
                        this.editor.plugins.BlockElements.instance.addAllowedAttribute("style");
                }
                if (!this.allowedAttributes) {
-                       this.allowedAttributes = new Array("id", "title", "lang", "xml:lang", "dir", (HTMLArea.is_gecko?"class":"className"), "style");
+                       this.allowedAttributes = new Array("id", "title", "lang", "xml:lang", "dir", "class", "style");
+                       if (HTMLArea.is_ie) {
+                               this.allowedAttributes.push("className");
+                       }
                }
 
                /*
index 4aa412b..71d6a6f 100644 (file)
@@ -1391,8 +1391,14 @@ 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");
                        }
                }
index 6721c1b..649df94 100644 (file)
@@ -90,7 +90,10 @@ TextStyle = HTMLArea.Plugin.extend({
                this.REInlineTags = /^(abbr|acronym|b|bdo|big|cite|code|del|dfn|em|i|ins|kbd|q|samp|small|span|strike|strong|sub|sup|tt|u|var)$/;
                
                        // Allowed attributes on inline elements
-               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.addAllowedAttribute("className");
+               }
                
                /*
                 * Registering plugin "About" information