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
postFinished = false;
periRange = document.selection.createRange().duplicate();
- preRange = rangeForElementIE( e ),
+ preRange = rangeForElementIE( e );
// Move the end where we need it
preRange.setEndPoint( 'EndToStart', periRange );
'</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.' );