[BUGFIX] In IE9, RTE does not work correctly in compat modes IE8/IE7
authorStanislas Rolland <typo3@sjbr.ca>
Tue, 3 Jul 2012 16:18:56 +0000 (12:18 -0400)
committerStanislas Rolland <typo3@sjbr.ca>
Tue, 3 Jul 2012 17:26:22 +0000 (19:26 +0200)
Problem: When using IE9, the RTE does not work correctly when using
compatibility modes IE8 or IE7. In particular, the style sheets are not
parsed, because they are not loaded in the same order as with the
specified compatibility version.
Solution: Check whether compatibility mode is activated and avoid
reliance on order.

Change-Id: Ie97df28e5add40f547a1952fcfd6ab30a5ab20b6
Releases: 4.5, 4.6, 4.7, 6.0
Resolves: #38574
Reviewed-on: http://review.typo3.org/12546
Reviewed-by: Stanislas Rolland
Tested-by: Stanislas Rolland
typo3/sysext/rtehtmlarea/htmlarea/htmlarea.js

index 0fb4d81..6a46c4a 100644 (file)
@@ -64,6 +64,10 @@ Ext.apply(HTMLArea, {
        RE_noClosingTag         : /^(img|br|hr|col|input|area|base|link|meta|param)$/i,
        RE_numberOrPunctuation  : /[0-9.(),;:!¡?¿%#$'"_+=\\\/-]*/g,
        /***************************************************
+        * BROWSER IDENTIFICATION                          *
+        ***************************************************/
+       isIEBeforeIE9: Ext.isIE6 || Ext.isIE7 || Ext.isIE8 || (Ext.isIE && typeof(document.documentMode) !== 'undefined' && document.documentMode < 9),
+       /***************************************************
         * TROUBLESHOOTING                                 *
         ***************************************************/
        _appendToLog: function(str){
@@ -942,7 +946,7 @@ HTMLArea.Iframe = Ext.extend(Ext.BoxComponent, {
         * @return      void
         */
        initializeCustomTags: function () {
-               if (Ext.isIE6 || Ext.isIE7 || Ext.isIE8 || (Ext.isIE && this.document.documentMode < 9)) {
+               if (HTMLArea.isIEBeforeIE9) {
                        Ext.each(this.config.customTags, function (tag) {
                                this.document.createElement(tag);
                        }, this);
@@ -1015,7 +1019,7 @@ HTMLArea.Iframe = Ext.extend(Ext.BoxComponent, {
                        }
                } else {
                                // Test if the styleSheets array is at all accessible
-                       if (Ext.isIE) {
+                       if (HTMLArea.isIEBeforeIE9) {
                                try {
                                        var rules = this.document.styleSheets[0].rules;
                                        var imports = this.document.styleSheets[0].imports;
@@ -1040,12 +1044,12 @@ HTMLArea.Iframe = Ext.extend(Ext.BoxComponent, {
                                        // Expecting 3 stylesheets...
                                if (this.document.styleSheets.length > 2) {
                                        Ext.each(this.document.styleSheets, function (styleSheet, index) {
-                                               if (Ext.isIE) {
+                                               if (HTMLArea.isIEBeforeIE9) {
                                                        try { 
                                                                var rules = styleSheet.rules;
                                                                var imports = styleSheet.imports;
                                                                        // Default page style may contain only a comment
-                                                               if (!rules.length && !imports.length && index != 1) {
+                                                               if (!rules.length && !imports.length && styleSheet.href.indexOf('defaultPageStyle') === -1) {
                                                                        stylesAreLoaded = false;
                                                                        errorText = 'Empty rules and imports arrays of styleSheets[' + index + ']';
                                                                        return false;