fancyapps/fancyBox — pull request #286 by ALLPRO (2012-06-19 17:13:29+00:00)
Title: Generate unique className so event delegation _always work_, regardless of jQuery selector used

Changed init code so that it no longer uses the original jQuery this.selector, which is not always valid for delegation and therefore can cause fancybox to fail. Instead, a random className is generated for each fancybox instance (eg: "fb_987654"). this generated class is added to all images in the instance, and then is set as the 'selector', eg: selector = ".fb_987654". This gives each instance a unique selector and allows delegation to _always work_ (unless options.live == false).

This changs avoids annoying, hard-to-trace errors like I had when using a selector like this:

$("#thumbs-wrapper").children("a").fancybox();