Skip to content

Event handlers not registering properly #210

@jgadbois

Description

@jgadbois

I have a page with a bunch of modals on it which weren't loading content inside properly. After looking through modal.js I finally found that

# modal.js - init function
this.on('hashchange', global, modal.mainHandler);
this.on('load', global, modal.mainHandler);

were not firing. I added some debug statements to the .on and it appears that the event name, element, and callback are all correct.

The strange thing is it is fixed by just doing the following:

  $(global).on('load', modal.mainHandler);
  $(global).on('hashchange', modal.mainHandler);
  //this.on('hashchange', global, modal.mainHandler);
  //this.on('load', global, modal.mainHandler);

I can't figure out for the life of me why that would matter, since this.on seems to register them the exact same way.

Possibly it has to do with having a bunch of modals on the page?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions