Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

'change' event fires on initialization only if registered before initialization #108

eleith opened this Issue Oct 15, 2011 · 1 comment


None yet
2 participants

eleith commented Oct 15, 2011

for me, most of the time, 'change' will get fired when jquery-address gets initialized. (i load all my scripts at the bottom of the page).

i take advantage of this first initial change trigger to check what the current URL is.

however, when i changed my scripts to load async, i realize that if my change binding got registered after jquery-address was initialized, i would miss out on the first change event being fired.

i want some consistency in when the change event gets fired

i have a few options

  1. check each time i register the change event, if jquery-address is already initialized, trigger my callback manually, otherwise jquery-address will do it for me
  2. have jquery-address not fire a change event on initialization, and i always run my callback manually
  3. have jquery-address fire a change event if one is registered but jquery-address is already initialized

i went with number three in my fork here 4069089

i like this solution better, since i can rely on jquery-address to do the work for me, without having to write extra logic in my other scripts

For this patch to work on 1.5 you'll have to change




in $.address._trigger

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment