Update jquery.trap.js

add checks to prevent infinite loop