From: Timo Tijhof Date: Mon, 30 Sep 2013 15:02:55 +0000 (+0200) Subject: Fix comma errors in various js files (new jshint warning) X-Git-Tag: 1.31.0-rc.0~18649^2 X-Git-Url: https://git.cyclocoop.org//%22?a=commitdiff_plain;h=81fd2fc17ccb303418636ef60f1aa6c13d9842e0;p=lhc%2Fweb%2Fwiklou.git Fix comma errors in various js files (new jshint warning) 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 --- diff --git a/resources/jquery/jquery.textSelection.js b/resources/jquery/jquery.textSelection.js index c44816b5e3..2b5a44068d 100644 --- a/resources/jquery/jquery.textSelection.js +++ b/resources/jquery/jquery.textSelection.js @@ -293,7 +293,7 @@ postFinished = false; periRange = document.selection.createRange().duplicate(); - preRange = rangeForElementIE( e ), + preRange = rangeForElementIE( e ); // Move the end where we need it preRange.setEndPoint( 'EndToStart', periRange ); diff --git a/tests/qunit/suites/resources/mediawiki/mediawiki.util.test.js b/tests/qunit/suites/resources/mediawiki/mediawiki.util.test.js index f2676d7d8f..08adb9388e 100644 --- a/tests/qunit/suites/resources/mediawiki/mediawiki.util.test.js +++ b/tests/qunit/suites/resources/mediawiki/mediawiki.util.test.js @@ -95,8 +95,8 @@ '' + '' + ''; - $( tocHtml ).appendTo( '#qunit-fixture' ), - $toggleLink = $( '#togglelink' ); + $( tocHtml ).appendTo( '#qunit-fixture' ); + $toggleLink = $( '#togglelink' ); assert.strictEqual( $toggleLink.length, 1, 'Toggle link is appended to the page.' );