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

Non-deterministic behavior when including widget twice on same page #109

Open
lrettig opened this issue Jul 23, 2015 · 6 comments
Open

Non-deterministic behavior when including widget twice on same page #109

lrettig opened this issue Jul 23, 2015 · 6 comments

Comments

@lrettig
Copy link

lrettig commented Jul 23, 2015

Hi Prem

Thanks for creating a really awesome tool. I've used sqwidget to create a set of widgets that are displayed on third party blogs (you can see one at the top left of www.amothershipdown.com). I've run into an issue when I try to include the same widget twice in the same page.

Basically, I sometimes get this error, sometimes not:

Uncaught TypeError: Cannot read property 'addMethod' of undefined

Which appears to be coming from jQuery and may indicate a namespace conflict?

Based on comments in your code it looks like loading the same code twice isn't currently supported. I also tried copying the code and loading it a second time from a second URL, which also didn't work.

Is there any way to display two sqwidgets on the same page?

Thanks

@mtree
Copy link

mtree commented Sep 21, 2015

Any progress on solving this problem?

@lrettig
Copy link
Author

lrettig commented Sep 21, 2015

None. I'm sure the nondeterministic nature of the problem has to do with the (random) order that the scripts are loaded. As far as I can tell, sqwidget does not support multiple widgets on the same page.

@premasagar
Copy link
Owner

Thanks for this issue and apologies for the non-reply. I don't see the issue on the link you provided, presumably because the document has changed. Are you able to provide a stripped down version of the issue?

Sqwidget should support multiple versions of a widget.

I should say, the library is not under active development at the moment. It may get my attention in future; for the meantime, pull requests and additional maintainers are welcome.

@lrettig
Copy link
Author

lrettig commented Oct 10, 2015

Hi @premasagar, I appreciate the response.

You can find the sqwidget in question here: http://widget.healthierapp.com/index-multi.html

If you glance at the HTML, you can see that I attempted to include the same widget twice, but it only appears once. Please let me know if I've missed something obvious.

Thanks!

@premasagar
Copy link
Owner

Hello @lrettig. In the browser consoles, Chrome says Uncaught TypeError: Cannot read property 'addMethod' of undefined healthier.js:formatted:14770 and Firefox TypeError: jQuery.validator is undefined healthier.js:10.

It is a little difficult to tell from the minified code. It would be a good idea to strip it down to the smallest parts that fail. The jQuery.validator seems to originate from "jquery-additional/additional-methods".

@lrettig
Copy link
Author

lrettig commented Nov 14, 2015

Hi @premasagar, sorry again for the slow response. Also sorry about the minified code. I uploaded a non-minified version of my code, at the above URL and here: http://widget.healthierapp.com/dist/healthier.js

Yes, this is the same error I see in Chrome.

I don't have time to troubleshoot this further right now but I'm happy to be helpful if I can be, please let me know.

Thanks!

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

3 participants