What do you think about this usage of for loop in JavaScript? Algorithm that I had to write is a perfect case for while, or do..while loop, however I found out that if I will implement it with a for loop I will save few lines of code and also scope of variables will be more appropriate. Take a look at the following code:

        for ( var i = 1, offset = -1; currentPosition.top === fakePosition.top &amp;&amp; offset !== 0; i++ ) {
            fakePosition.top -= i * 10;
            offset = this.documentView.getOffsetFromPosition( fakePosition );
            fakePosition = this.documentView.getRenderedPosition( offset );
        }


As you can see second parameter is very atypical as for for loops. My mine reason to switch to this loop was fact that I need iterator (i) and offset variables inside loop (and only there).

What do you think about this approach?
As you can see second parameter is very atypical as for for loops


Which is why it shouldn't be a for loop, because as you write yourself(!) "[it] is a perfect case for while, or do..while loop". Saving a few lines of code and variable scope is not a good reason to obscure the code. You will (or should) be losing any perceived time/line benefit in writing the comments necessary to explain your trickery. If you want to limit variable scope, declare a new scope or function.  

As @Raynos alludes to in the comments, you should avoid "magic", or rather, complicated expressions in your for loops (and other conditional statements). It might not look bad to you now (though it probably will in X months), but consider what happens when your boss/client asks you to add support for a special case. Very quickly it'll look like this:

    for ( var i = 1, offset = -1; currentPosition.top === fakePosition.top &amp;&amp; offset !== 0 &amp;&amp; currentPosition.top != -1 /* browser XYZ gives bogus answer */ &amp;&amp; offset &lt; fakePosition.bottom /* handle condition explained in ticket #123 */; i++ ) {
        fakePosition.top -= i * 10;
        offset = this.documentView.getOffsetFromPosition( fakePosition );
        fakePosition = this.documentView.getRenderedPosition( offset );
    }