aralejs/position — pull request #11 by HerringtonDarkholme (2014-05-05 08:27:09+00:00)
Title: Do nothing when pinObject is a nonexistent element 

Because `Position` normalizes pinObject (as in `Position.pin`'s signature), its `element` will become a `VIEWPORT` plain object when `pinObject` contains a nonexistent element.
This would break the following [CSS query](https://github.com/aralejs/position/blob/master/src/position.js#L28) in old IE(<=9) if the user is not meticulous enough.

However, passing empty jQuery object is quite pervasive, and it is even harder to preclude pernicious problems like this: `$('

').appendTo('#yet-another-nonexistent')`. `jQuery` creates a detached `div` but removes it then because no container is found. The final result is still an empty $ object.

In old IE, this exception freezes all subsequent code in the same context, even if `Position.pin` is wrapped in `try..catch..` block. In modern browsers this does not matter much but still halting futile code execution is preferred.

`Position` can be more care-free if the burden of validating element is placed not no users. I hope this patch can make it done.

I tried to write new test case in the specs but did not manage to set up the test environment. I only tested on my local project, I wish this revision will pass.

Best wishes