waitForElementChange() callback return value was not being used

This patch is a re-submit against 1.7 branch to replace #666.

I'm using a different laptop and it looks like it's stripped some redundant whitespace but otherwise the commit is the same as before.