This code:
var target = {"x": targetX, "y": targetY};
if (this.isPathClear(this.pos, target.pos))
this.move(target.pos);
should be:
var target = {"x": targetX, "y": targetY};
if (this.isPathClear(this.pos, target))
this.move(target);
But when you put in the first code, instead of saying "target.pos is not defined" or the like, it says isPathClear is not defined. Which is wrong, because isPathClear works fine.
Probably somewhere in there we have some shortcut logic for figuring out which variable it was that was not defined, and it's being too dumb and just taking the this.[whatever] variable in the line of code.