Skip to content
New issue

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

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: ensure initialization completes on subsequent attempts #428

Merged
merged 1 commit into from
Dec 31, 2024

Conversation

techfg
Copy link
Collaborator

@techfg techfg commented Dec 31, 2024

IMPORTANT

What is this change for?

  • Feature / enhancement - Any change should be discussed in the associated Issue before proceeding. Failure to do so may result in the rejection of the pull request.
  • Bug
  • Docs
  • Tests

Description (required)

The underlying issue is actually a regression from 0aca845 way back in October 2011. In that commit, there was an change in approach to how deferred methods were executed. Prior to the commit, when the situation arose were initialization was called but something else was "in-flight", bind (the equivalent of initialization) was added to the command processing queue. However, in the change, Lines 2165 thru 2172, img.bind was put in its place which would actually call the jquery.bind method (aka. jquery.on) to register an event listener. The changes in this commit are the root cause of why this bug currently exists.

Since the above commit, the code was calling jquery.bind with no parameters which actually does nothing and even with parameters, would not have been an equivalent replacement in functionality to the previous queue_command that was called.

In 48125a6, the img.unbind was fixed to properly queue an unbind command, however the img.bind was not updated/fixed.

In this commit, bind was changed to on since bind was deprecated in jQuery 3.

Finally, in this commit, on was removed entirely since it does not do anything to begin with (see above).

In short, the change made in 0aca845 was incorrect and it should have queued a bind/initialization when map data is already present. This ensures that the unbind called just prior completes fully before mapster is reinitialized.

This PR corrects the issue and ensures mapster is successfully initialized even on multiple initialization calls.

Test plan (required)

Closing issues

Closes #427

@techfg techfg merged commit 52543c1 into main Dec 31, 2024
@techfg techfg deleted the fix/issue-427 branch December 31, 2024 07:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[🐞] imagemapster is not bound to an image map when imagemapster is "re"-initialized
1 participant