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

Works in Firefox but not Chrome.... #3

Closed
INF1949 opened this issue Mar 15, 2015 · 3 comments
Closed

Works in Firefox but not Chrome.... #3

INF1949 opened this issue Mar 15, 2015 · 3 comments

Comments

@INF1949
Copy link

INF1949 commented Mar 15, 2015

After reading your SPA book I was inspired to use your subscribe/publish extension in my own simple program. It works splendidly in Firefox but published events appear to be ignored in Chrome (most current version). This occurs -- or more accurately doesn't occur -- in Chrome on both my PC and Android phone. (Firefox behaves as expected on both OS's.) And it only works some of the time (????) in IE11. Could the problem be that the event is registered against a jQuery collection within an iframe?

@mmikowski
Copy link
Owner

Hi INF:

gevent has been tested in IE9+, Firefox 12+, and Chrome 10+. That doesn't mean it works everywhere of course. However, I am using it for a current project using the latest Chrome (v41) and jQuery (2.1.3) and it works flawlessly. My guess is it may be the way you are using it. If you want to subscribe to an event but don't that subscription tied to an element, bind it instead to the body. Here is an example from my current project:

// Publish
$.gevent.publish( 'set_mode', {
  mode_str      : 'add',
  hi_score_list : hi_score_list,
  hi_score_idx  : hi_score_idx
}); 

// Subscribe
$.gevent.subscribe( $body, '_set_mode_',  onSetMode )

If you continue to have difficulty, please me a means to reproduce the issue - the easier the better. Like "use crossbrowsertesting.com to access this page using IE11 on Windows 8.1", where this page is your page illustrating the problem. I would certainly be glad to ensure that gevent continues to work across all modern browsers :)

@INF1949
Copy link
Author

INF1949 commented Mar 17, 2015

You're right, my problem isn't caused by gevent which, after stepping through the code in Chrome/debugging, I've been able to verify works just fine. I'll have to look elsewhere to figure out the bug.

@INF1949 INF1949 closed this as completed Mar 17, 2015
@mmikowski
Copy link
Owner

Cool. Thanks for confirming.

My guess is you are seeing x-browser vageries. Try to use jQuery utilities to normalize as much as possible. Avoid underscore utilities in favor of jQuery utilities (I stopped using underscore because it is generally slower and less correct than jQuery, and the overlap is ~90% - not worth it!)

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

No branches or pull requests

2 participants