{"action":"created","issue":{"url":"https://api.github.com/repos/t4t5/sweetalert/issues/722","repository_url":"https://api.github.com/repos/t4t5/sweetalert","labels_url":"https://api.github.com/repos/t4t5/sweetalert/issues/722/labels{/name}","comments_url":"https://api.github.com/repos/t4t5/sweetalert/issues/722/comments","events_url":"https://api.github.com/repos/t4t5/sweetalert/issues/722/events","html_url":"https://github.com/t4t5/sweetalert/issues/722","id":258104641,"number":722,"title":"Argument error in iframes","user":{"login":"polianomartini","id":13044849,"avatar_url":"https://avatars0.githubusercontent.com/u/13044849?v=4","gravatar_id":"","url":"https://api.github.com/users/polianomartini","html_url":"https://github.com/polianomartini","followers_url":"https://api.github.com/users/polianomartini/followers","following_url":"https://api.github.com/users/polianomartini/following{/other_user}","gists_url":"https://api.github.com/users/polianomartini/gists{/gist_id}","starred_url":"https://api.github.com/users/polianomartini/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/polianomartini/subscriptions","organizations_url":"https://api.github.com/users/polianomartini/orgs","repos_url":"https://api.github.com/users/polianomartini/repos","events_url":"https://api.github.com/users/polianomartini/events{/privacy}","received_events_url":"https://api.github.com/users/polianomartini/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":6,"created_at":"2017-09-15T17:03:23Z","updated_at":"2018-02-09T00:42:42Z","closed_at":null,"author_association":"NONE","body":"Hi, my dear!\r\n\r\nI use SweetAlert in a project, but I noticed that there were some changes.\r\n\r\nBefore, I imported a JS file and a CSS into the body of HTML. I downloaded the latest \"sweetalert.min.js\" file and imported it as before but I'm having trouble using it.\r\n\r\nThe call below runs successfully:\r\n`swal (\"Hello world!\");`\r\n\r\n\r\nBut this other:\r\n`swal ({\r\n   title: \"Good job!\",\r\n   text: \"You clicked the button!\",\r\n   icon: \"success\",\r\n});`\r\n\r\n... the following error occurs:\r\n\r\n> Uncaught SweetAlert: 1st argument ('[object Object]') is invalid\r\n\r\nI'm doing something wrong?"},"comment":{"url":"https://api.github.com/repos/t4t5/sweetalert/issues/comments/364298053","html_url":"https://github.com/t4t5/sweetalert/issues/722#issuecomment-364298053","issue_url":"https://api.github.com/repos/t4t5/sweetalert/issues/722","id":364298053,"user":{"login":"lionralfs","id":16670790,"avatar_url":"https://avatars0.githubusercontent.com/u/16670790?v=4","gravatar_id":"","url":"https://api.github.com/users/lionralfs","html_url":"https://github.com/lionralfs","followers_url":"https://api.github.com/users/lionralfs/followers","following_url":"https://api.github.com/users/lionralfs/following{/other_user}","gists_url":"https://api.github.com/users/lionralfs/gists{/gist_id}","starred_url":"https://api.github.com/users/lionralfs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lionralfs/subscriptions","organizations_url":"https://api.github.com/users/lionralfs/orgs","repos_url":"https://api.github.com/users/lionralfs/repos","events_url":"https://api.github.com/users/lionralfs/events{/privacy}","received_events_url":"https://api.github.com/users/lionralfs/received_events","type":"User","site_admin":false},"created_at":"2018-02-09T00:42:42Z","updated_at":"2018-02-09T00:42:42Z","author_association":"COLLABORATOR","body":"I've done some digging and think I found the cause of this bug:\r\n\r\nWhen `swal` is called from inside an iframe, the condition `prototype === Object.prototype` in [this line](https://github.com/t4t5/sweetalert/blob/master/src/modules/utils.ts#L44) seems to return `false`.\r\n\r\nOn the other hand, when used outside of an iframe (or the console), `prototype === Object.prototype` returns `true`.\r\n\r\nThis results in `isPlainObject` returning `false` and an error is thrown, because swal assumes the parameters are invalid.\r\n\r\nApparently Object prototypes are different in different frames, @t4t5 do you know more about this?\r\n\r\nPRs are welcome 😃 "}}
{"actor":{"display_login":"lionralfs"}}