Page MenuHomePhabricator

jquery.client shouldn't use eval
Open, HighPublic

Description

jquery.client currently uses eval in two places to compare two numbers. There aren't that many possible comparison operators in JS, so this can easily be done with a switch statement instead:

function compare( a, op, b ) {
 switch ( op )  {
 case '<': return a < b;
 //etc.
 }
}

Not using eval when it's not really necessary is always a good idea.