jquery/jquery-mobile — pull request #6718 by BendingBender (2013-11-10 23:24:50+00:00)
Title: Correct orientationchange when iphones starting app via launcher icon while being held in landscape orientation

Currently, when an app is stored as an app launcher icon on iPhone's home screen and app is being started while the device is held in landscape orientation, jQuery mobile flips the orientation events i.e. it reports "landscape"
when device is held in portrait mode and vice versa. This behaviour could be only observed on iPhone devices (tested with iOS6 & 7), iPads don't suffer from this bug.

The problem is that the initial value of `window.orientation` may be incorrect while starting app and holding device in landscape orientation. This variable states that device is still in portrait mode while `window.innerHeight` and `window.innerWidth` are already set to landscape dimensions. It seems that `window.orientation` is only corrected when the `ready` event is fired.

This commit fixes the problem by triggering the decision logic once again on document ready if we previously had to flip orientation values to normalize output for other devices.