Fix comma errors in various js files (new jshint warning)
authorTimo Tijhof <krinklemail@gmail.com>
Mon, 30 Sep 2013 15:02:55 +0000 (17:02 +0200)
committerKrinkle <krinklemail@gmail.com>
Mon, 30 Sep 2013 15:05:08 +0000 (15:05 +0000)
We're about to upgrade to JSHint 2.x. Among various improvements
it now properly detects incorrect use of the comma operator.

This helped uncover two mistakes that could solve a bug, though
in this case the difference was purely in the semantics. The
endresult is unchanged.

Incorrect use of the comma operator can lead to assigning the
wrong value to a variable or causing an implied global variable.

> $ jshint --version
> jshint v2.1.11
> $ jshint .
> resources/jquery/jquery.textSelection.js: line 298, col 71, Expected an assignment or function call and instead saw an expression.
>
> tests/qunit/suites/resources/mediawiki/mediawiki.util.test.js: line 99, col 44, Expected an assignment or function call and instead saw an expression.
>
> 2 errors

Change-Id: I6fdae5f66ef69b6526121cd7b1b2fbb0d9df7a62

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

index c44816b..2b5a440 100644 (file)
                                                postFinished = false;
                                                periRange = document.selection.createRange().duplicate();
 
-                                               preRange = rangeForElementIE( e ),
+                                               preRange = rangeForElementIE( e );
                                                // Move the end where we need it
                                                preRange.setEndPoint( 'EndToStart', periRange );
 
index f2676d7..08adb93 100644 (file)
@@ -95,8 +95,8 @@
                        '</div>' +
                        '<ul><li></li></ul>' +
                        '</div>';
-               $( tocHtml ).appendTo( '#qunit-fixture' ),
-                       $toggleLink = $( '#togglelink' );
+               $( tocHtml ).appendTo( '#qunit-fixture' );
+               $toggleLink = $( '#togglelink' );
 
                assert.strictEqual( $toggleLink.length, 1, 'Toggle link is appended to the page.' );