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.