changeset 5799:fe33650291f3

added workaround for IE8 script loop, thanks to Roger Haase
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Tue, 29 Nov 2011 00:03:16 +0100
parents d0599106e17a
children 4ab3c578e44b
files MoinMoin/web/static/htdocs/common/js/common.js
diffstat 1 files changed, 9 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/web/static/htdocs/common/js/common.js	Mon Nov 28 23:57:01 2011 +0100
+++ b/MoinMoin/web/static/htdocs/common/js/common.js	Tue Nov 29 00:03:16 2011 +0100
@@ -500,7 +500,7 @@
     if (txtBox) {
         // Calculate the cursor position - IE supports innerText, not textContent
         var textLines = txtBox.textContent || txtBox.innerText;
-        textLines = textLines.match(/(.*\n)/g);
+        textLines = textLines.match(/(.*(\r\n|\r|\n))/g);
         var scrolledText = '';
         for (var i = 0; i < textLines.length && i < jumpLine; ++i) {
             scrolledText += textLines[i];
@@ -628,9 +628,16 @@
             //~ return;
         //~ }
     //~ }
-
+    
+    var ie8LoopCounter = 0;
     var doChild = true;
     while (!(someNode.id == nextId) && !(someNode.id == topId)) {
+        // workaround IE8 bug:  http://moinmo.in/MoinMoinBugs/FormInsideTableCausesIE8ScriptLoop
+        ie8LoopCounter += 1;
+        if (ie8LoopCounter > 10000) {
+            return;
+        }
+        
         // add children, add siblings, add parent
         if (doChild && someNode.firstChild) {
             someNode = someNode.firstChild;