{"action":"created","issue":{"url":"https://api.github.com/repos/ibericode/mailchimp-for-wordpress/issues/220","labels_url":"https://api.github.com/repos/ibericode/mailchimp-for-wordpress/issues/220/labels{/name}","comments_url":"https://api.github.com/repos/ibericode/mailchimp-for-wordpress/issues/220/comments","events_url":"https://api.github.com/repos/ibericode/mailchimp-for-wordpress/issues/220/events","html_url":"https://github.com/ibericode/mailchimp-for-wordpress/issues/220","id":121308343,"number":220,"title":"Don't print_dummy_javascript when not necessary","user":{"login":"kasparsd","id":169055,"avatar_url":"https://avatars.githubusercontent.com/u/169055?v=3","gravatar_id":"","url":"https://api.github.com/users/kasparsd","html_url":"https://github.com/kasparsd","followers_url":"https://api.github.com/users/kasparsd/followers","following_url":"https://api.github.com/users/kasparsd/following{/other_user}","gists_url":"https://api.github.com/users/kasparsd/gists{/gist_id}","starred_url":"https://api.github.com/users/kasparsd/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kasparsd/subscriptions","organizations_url":"https://api.github.com/users/kasparsd/orgs","repos_url":"https://api.github.com/users/kasparsd/repos","events_url":"https://api.github.com/users/kasparsd/events{/privacy}","received_events_url":"https://api.github.com/users/kasparsd/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2015-12-09T18:21:13Z","updated_at":"2015-12-11T11:07:28Z","closed_at":null,"body":"`print_dummy_javascript()` in `MC4WP_Form_Asset_Manager` shouldn't be added to `<head>` by default, especially since there is no way of removing because `init_asset_manager()` stores the instance reference in a local variable in `MC4WP_Form_Manager`.\r\n\r\nI noticed that only very recently (3.0.0 & 3.0.1 - November 23, 2015) you switched from binding to `document` to using a global `mc4wp`:\r\n\r\n> Event binding: `jQuery(document).on('subscribe.mc4wp','.mc4wp-form', function(){ ... })` is now `mc4wp.forms.on('subscribed', function(form) { ... })`\r\n\r\nI'm not sure why you decided to change it but using globals is not the right approach, I think."},"comment":{"url":"https://api.github.com/repos/ibericode/mailchimp-for-wordpress/issues/comments/163911638","html_url":"https://github.com/ibericode/mailchimp-for-wordpress/issues/220#issuecomment-163911638","issue_url":"https://api.github.com/repos/ibericode/mailchimp-for-wordpress/issues/220","id":163911638,"user":{"login":"dannyvankooten","id":885856,"avatar_url":"https://avatars.githubusercontent.com/u/885856?v=3","gravatar_id":"","url":"https://api.github.com/users/dannyvankooten","html_url":"https://github.com/dannyvankooten","followers_url":"https://api.github.com/users/dannyvankooten/followers","following_url":"https://api.github.com/users/dannyvankooten/following{/other_user}","gists_url":"https://api.github.com/users/dannyvankooten/gists{/gist_id}","starred_url":"https://api.github.com/users/dannyvankooten/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dannyvankooten/subscriptions","organizations_url":"https://api.github.com/users/dannyvankooten/orgs","repos_url":"https://api.github.com/users/dannyvankooten/repos","events_url":"https://api.github.com/users/dannyvankooten/events{/privacy}","received_events_url":"https://api.github.com/users/dannyvankooten/received_events","type":"User","site_admin":false},"created_at":"2015-12-11T11:07:28Z","updated_at":"2015-12-11T11:07:28Z","body":"Hi @kasparsd ,\r\n\r\nI like your second suggestion, but the PR is not quite there yet. The `mc4wp_output_form` sometimes runs in a context where the the output is not echoed but returned as a variable, so that should be taken into account.\r\n\r\nThis happens when rendering a shortcode, for example. \r\n\r\nThat said, it's definitely do-able. First thing I can think of is to start a separate output buffer that captures all output (so form HTML + any HTML outputted by the action callbacks) and returns that. "}}