{"action":"created","issue":{"url":"https://api.github.com/repos/nprapps/pym.js/issues/95","labels_url":"https://api.github.com/repos/nprapps/pym.js/issues/95/labels{/name}","comments_url":"https://api.github.com/repos/nprapps/pym.js/issues/95/comments","events_url":"https://api.github.com/repos/nprapps/pym.js/issues/95/events","html_url":"https://github.com/nprapps/pym.js/issues/95","id":95952465,"number":95,"title":"Initializes inline, rather than on document ready","user":{"login":"coreyhaines","id":3962,"avatar_url":"https://avatars.githubusercontent.com/u/3962?v=3","gravatar_id":"","url":"https://api.github.com/users/coreyhaines","html_url":"https://github.com/coreyhaines","followers_url":"https://api.github.com/users/coreyhaines/followers","following_url":"https://api.github.com/users/coreyhaines/following{/other_user}","gists_url":"https://api.github.com/users/coreyhaines/gists{/gist_id}","starred_url":"https://api.github.com/users/coreyhaines/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/coreyhaines/subscriptions","organizations_url":"https://api.github.com/users/coreyhaines/orgs","repos_url":"https://api.github.com/users/coreyhaines/repos","events_url":"https://api.github.com/users/coreyhaines/events{/privacy}","received_events_url":"https://api.github.com/users/coreyhaines/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/nprapps/pym.js/labels/LOW","name":"LOW","color":"5319e7"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2015-07-19T22:03:14Z","updated_at":"2015-07-20T12:42:40Z","closed_at":null,"body":"We ran into this issue when pym was included in the head of the document. Because the pym script auto-initializes at load time, not document ready, it doesn't see the div tags that have a data-pym-src attribute. We have to tell our clients to put the script include at the bottom of the page. This isn't always feasible.\r\nWould it be possible to have the initialization run at document load, so we have all the divs that mark an iframe ready?"},"comment":{"url":"https://api.github.com/repos/nprapps/pym.js/issues/comments/122872181","html_url":"https://github.com/nprapps/pym.js/issues/95#issuecomment-122872181","issue_url":"https://api.github.com/repos/nprapps/pym.js/issues/95","id":122872181,"user":{"login":"coreyhaines","id":3962,"avatar_url":"https://avatars.githubusercontent.com/u/3962?v=3","gravatar_id":"","url":"https://api.github.com/users/coreyhaines","html_url":"https://github.com/coreyhaines","followers_url":"https://api.github.com/users/coreyhaines/followers","following_url":"https://api.github.com/users/coreyhaines/following{/other_user}","gists_url":"https://api.github.com/users/coreyhaines/gists{/gist_id}","starred_url":"https://api.github.com/users/coreyhaines/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/coreyhaines/subscriptions","organizations_url":"https://api.github.com/users/coreyhaines/orgs","repos_url":"https://api.github.com/users/coreyhaines/repos","events_url":"https://api.github.com/users/coreyhaines/events{/privacy}","received_events_url":"https://api.github.com/users/coreyhaines/received_events","type":"User","site_admin":false},"created_at":"2015-07-20T12:42:40Z","updated_at":"2015-07-20T12:42:40Z","body":"@onyxfish I haven't looked into the code totally deeply, but it appears this\r\nhttps://github.com/nprapps/pym.js/blob/master/src/pym.js#L14\r\nis the cause of my issue. As soon as the script loads, the factory gets executed, which has a raw call to `_autoInit()`\r\nhttps://github.com/nprapps/pym.js/blob/master/src/pym.js#L582\r\n\r\nThis means that the script tag has to be located AFTER the marker div.\r\n\r\nPerhaps wrapping the call to `_autoInit()` to execute on the DOMContentLoaded event? Admittedly I don't know all the use cases you had, but was there a reason to have it execute immediately?"}}