StephanWagner/jBox — pull request #5 by alpadev (2014-08-10 17:10:10+00:00)
Title: Adds: Fallback if opts.attach.selector is empty

If jbox.options.attach.selector equals "" ( which is the case when used like this $('p').first().jBox(...) ) it will fallback to whatever this.options.attach is set to (in that case mentioned to "$('p').first()").

I'm scratching my head why you relate on that selector thing or if that was even on purpose. The only reason that comes into my mind is you want to have it working if attached elements are regularly getting replaced with new created ones but even then the selector eventually will have a given context that is not a string(e.g. $('p', '.first') will just return p(s) in $('.first') has a context of document and the given context is merged into the selector that is '.first p' while $('p', $('.first')[0]) will have the same result but has a context of HTMLElement and the selector alone is 'p' and thus not enough to build a correct set of elements). Also since jbox is only attached once at creation time that will not cover it I guess.

By passing the options.attach directly into jquery you will enable constructs like
```js
$('p').each(function () {
$(this).closest('.first').length && new jBox(... ,attach: this });
});
```
or
```js
$('.btn').click(function () { $(this).jBox(...) })
```
to work as intended. I know the first one isn't really useful but you get the point :)

I'd also remove that attach.selector thing completely since it's imo not something to relate completely on but that is up to you.