Bugfix. Modal height wasn't being calculated correctly.

The functions setPosition and measure didn't have access to $el on which the
pattern was applicable.

Instead they used jQuery to get the element. The problem occurs when there
are multiple div.pat-modal elements in the page. Then there's no way to know
which one is the right one.

The fix is the set the correct $el element on the pattern and to access that in
setPosition and measue. "measure" is called asynchronously, so we have to use $.proxy to
make sure it has access to the pattern object.
Proxy callbacks to setPosition so that it has correct context.

This is related to the previous modal bugfix.
Check whether $el is defined at all.

Fixes a race-condition, whereby setPosition is called from the patterns-inject
event handler before the modal has been initialized.
Enfore a one-to-one mapping between modal objs and DOM elements.

Otherwise we run into a situation where a modal is referencing a collection of
DOM elements and we don't know which one is correct in a specific instance.
set height to calculated height instead of '', fixes invisible content issue
Add a test for d11721278686164f68885248f086ddb30101b361
Fix modal resize on content load.
Bugfix. Modals weren't correctly being positioned/sized.

In the measure function, while trying to calculate the correct height, the
height of the modal clone was incorrect. It was the same as the outer #pat-modal object
but in effect the modal itself was taller (due to .panel-content being taller).

Instead we calculate the true height, which is either #pat-modal or
.panel-content, depending on which is higher.

Additionally I added callWhenReady method that will call a callback only once
an element has been proven to be attached to the DOM.
Slight refactor. Read below pls.

Don't set $el on this ('this' being the modal pattern instance), since there is
only one global pattern instance and not a one-to-one mapping between pattern
and $el.

See: https://github.com/Patternslib/Patterns/issues/345

We have to overcome the original problem of not having access to $el from
within setPosition. I've done that now by only registering the event handlers
once the modal is actually being rendered and binding $el to the event handler.

This is nicer in any case because it reduces the number of handler calls.

Tests still pass and tested with various tricky modals in Star.
Another refactor. See below.

Previously the way setPosition calculated the proper height for a modal was to
clone it and remove the height css attr from the clone. I assume the theory
being that the clone will automatically resize to its full height and from that
the height of the modal can be calculated. In practice this didn't always work.

Now, instead of making a clone, I calculate the height by getting the height of
the tallest element inside the modal. This simplifies things a bit (removes
need for two separate methods).

I also debounce the calls to setPosition.
Add hack to make modal within modal.max-height work.
Add changelog entry for modal changes.
jshint fixes.