qopied from jquery1.7.1