Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Google closure compiler warns on line in createVirtualEvent #5246

Open
btrscott opened this Issue · 0 comments

1 participant

@btrscott

Google doesn't seem to line

    for ( i = props.length, prop; i; ) {   <<<<<<<<<<<<
        prop = props[ --i ];
        event[ prop ] = oe[ prop ];
    }

WARNING - Suspicious code. This code lacks side-effects. Is there a bug?

for ( i = props.length, prop; i; ) {
.....................................^

It's an unusual for structure from my view. Not saying it doesn't work but it sure looks non-standard.

Missing 3rd position incrementing function; seems to be handled within the look with the --i. Odd multiple assignment in first for position.

My guess would be:

    for ( i = props.length; i; ) {   <<<<<<<<<<<<
        prop = props[ --i ];
        event[ prop ] = oe[ prop ];
    }

But even that is not straight forward. Maybe:

    for ( i = props.length-1; i<0; i--) {   <<<<<<<<<<<<
        prop = props[ i ];
        event[ prop ] = oe[ prop ];
    }

Course counting up is more traditional but I don't know if there is another reason requiring that you go backwards.

    for ( i = 0; i<props.length; i++) {   <<<<<<<<<<<<
        prop = props[ i ];
        event[ prop ] = oe[ prop ];
    }

Maybe the original code is highly optimized to those who understand the lower workings of Javascript?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.