jquery.textSelection.test: Fix regression in Opera
authorMatmaRex <matma.rex@gmail.com>
Sat, 23 Mar 2013 20:03:04 +0000 (21:03 +0100)
committerKrinkle <ttijhof@wikimedia.org>
Thu, 28 Mar 2013 04:56:27 +0000 (04:56 +0000)
Removing a window.opera-guarded part of code that was supposed to
"[c]ompensate for Opera's craziness converting \n to \r\n and counting
that as two chars". That craziness was apparently fixed some time ago
and the tests were now failing.

This makes the QUnit tests pass on Opera again.

Bug: 41931
Change-Id: Ide3a95e8e86ee65c8e1ea357aefa44dd2bbd4ed4

tests/qunit/suites/resources/jquery/jquery.textSelection.test.js

index ce03b69..5fe2394 100644 (file)
 
                        var start = opt.before.start,
                                end = opt.before.end;
-                       if ( window.opera ) {
-                               // Compensate for Opera's craziness converting \n to \r\n and counting that as two chars
-                               var newLinesBefore = opt.before.text.substring( 0, start ).split( '\n' ).length - 1,
-                                       newLinesInside = opt.before.text.substring( start, end ).split( '\n' ).length - 1;
-                               start += newLinesBefore;
-                               end += newLinesBefore + newLinesInside;
-                       }
 
                        var options = $.extend( {}, opt.replace ); // Clone opt.replace
                        options.selectionStart = start;