Added feature #10842: htmlArea RTE: Let IE8 display language marks like other browsers do
authorStanislas Rolland <typo3@sjbr.ca>
Fri, 3 Apr 2009 22:26:32 +0000 (22:26 +0000)
committerStanislas Rolland <typo3@sjbr.ca>
Fri, 3 Apr 2009 22:26:32 +0000 (22:26 +0000)
git-svn-id: https://svn.typo3.org/TYPO3v4/Core/trunk@5274 709f56b5-9817-0410-a4d7-c38de5d9e867

ChangeLog
typo3/sysext/rtehtmlarea/ChangeLog
typo3/sysext/rtehtmlarea/htmlarea/plugins/Language/language.js

index 0f6d052..0d78bf6 100755 (executable)
--- a/ChangeLog
+++ b/ChangeLog
@@ -2,6 +2,7 @@
 
        * Fixed issue #10837: htmlARea RTE: IE8 reports unknown "complete" attribute on img nodes
        * Fixed bug #10836: htmlARea RTE: RTE leaves unwanted id attribute on inserted table in IE8
+       * Added feature #10842: htmlArea RTE: Let IE8 display language marks like other browsers do
 
 2009-04-03  Patrick Broens  <patrick@patrickbroens.nl>
 
index 69df9f3..72e79ae 100644 (file)
@@ -2,6 +2,7 @@
 
        * Fixed issue #10837: htmlARea RTE: IE8 reports unknown "complete" attribute on img nodes
        * Fixed bug #10836: htmlARea RTE: RTE leaves unwanted id attribute on inserted table in IE8
+       * Added feature #10842: htmlArea RTE: Let IE8 display language marks like other browsers do
 
 2009-04-02  Stanislas Rolland  <typo3@sjbr.ca>
 
index d0f7cfc..1ec72c9 100644 (file)
@@ -135,22 +135,21 @@ Language = HTMLArea.Plugin.extend({
        onGenerate : function () {
                        // Add rules to the stylesheet for language mark highlighting
                        // Model: body.htmlarea-show-language-marks *[lang=en]:before { content: "en: "; }
-                       // Such rule is not supported by Internet Explorer
-               if (HTMLArea.is_gecko) {
-                       var obj = this.getDropDownConfiguration("Language");
-                       if ((typeof(obj) !== "undefined") && (typeof(this.editor._toolbarObjects[obj.id]) !== "undefined")) {
-                               var styleSheet = this.editor._doc.styleSheets[0];
-                               var select = document.getElementById(this.editor._toolbarObjects[obj.id].elementId);
-                               var options = select.options;
-                               var rule;
-                               for (var i = options.length; --i >= 0;) {
-                                       if (this.useAttribute.lang) {
-                                               rule = 'body.htmlarea-show-language-marks *[lang=' + options[i].value + ']:before { content: "' + options[i].value + ': "; }';
-                                               styleSheet.insertRule(rule, styleSheet.cssRules.length);
-                                       } else if (this.useAttribute.xmlLang) {
-                                               rule = 'body.htmlarea-show-language-marks *[xml:lang=' + options[i].value + ']:before { content: "' + options[i].value + ': "; }';
-                                               styleSheet.insertRule(rule, styleSheet.cssRules.length);
-                                       }
+                       // Works in IE8, but not in earlier versions of IE
+               var obj = this.getDropDownConfiguration("Language");
+               if ((typeof(obj) !== "undefined") && (typeof(this.editor._toolbarObjects[obj.id]) !== "undefined")) {
+                       var styleSheet = this.editor._doc.styleSheets[0];
+                       var select = document.getElementById(this.editor._toolbarObjects[obj.id].elementId);
+                       var options = select.options;
+                       var rule, selector, style;
+                       for (var i = options.length; --i >= 0;) {
+                               selector = 'body.htmlarea-show-language-marks *[' + (this.useAttribute.lang ? 'lang=' : 'xml:lang=') + options[i].value + ']:before';
+                               style = 'content: "' + options[i].value + ': "';
+                               rule = selector + ' { ' + style + '; }';
+                               if (HTMLArea.is_gecko) {
+                                       styleSheet.insertRule(rule, styleSheet.cssRules.length);
+                               } else {
+                                       styleSheet.addRule(selector, style);
                                }
                        }
                }