detro/ghostdriver — pull request #86 by jimevans (2012-10-09 13:38:42+00:00)
Title: Fragment load fix

GhostDriver does not recognize navigating to a fragment on the same page. This pull request addresses the issue. The logic bears some explaining. If we are loading a new page, the loadStarted event will fire, then urlChanged, then loadFinished, assuming no errors. However, when navigating to a fragment on the same page, neither the loadStarted nor the loadFinished events will fire. So if we receive a urlChanged event without a corresponding loadStarted event, we know we are only navigating to a fragment on the same page, and should fire the onLoadFunc callback. Otherwise, we need to wait until the loadFinished event before firing the callback.

Feel free to monkey with the logic of this pull request if you know of a better way to accomplish this.