Add compatibility for jQuery < 1.7 and keeping it for above