{"action":"created","issue":{"url":"https://api.github.com/repos/yiisoft/yii2/issues/8702","labels_url":"https://api.github.com/repos/yiisoft/yii2/issues/8702/labels{/name}","comments_url":"https://api.github.com/repos/yiisoft/yii2/issues/8702/comments","events_url":"https://api.github.com/repos/yiisoft/yii2/issues/8702/events","html_url":"https://github.com/yiisoft/yii2/issues/8702","id":86163933,"number":8702,"title":"Inline registering of javascript during PJAX calls uses document.on('ready') instead of document.on('ready pjax:end')","user":{"login":"sergeantjonas","id":10808486,"avatar_url":"https://avatars.githubusercontent.com/u/10808486?v=3","gravatar_id":"","url":"https://api.github.com/users/sergeantjonas","html_url":"https://github.com/sergeantjonas","followers_url":"https://api.github.com/users/sergeantjonas/followers","following_url":"https://api.github.com/users/sergeantjonas/following{/other_user}","gists_url":"https://api.github.com/users/sergeantjonas/gists{/gist_id}","starred_url":"https://api.github.com/users/sergeantjonas/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sergeantjonas/subscriptions","organizations_url":"https://api.github.com/users/sergeantjonas/orgs","repos_url":"https://api.github.com/users/sergeantjonas/repos","events_url":"https://api.github.com/users/sergeantjonas/events{/privacy}","received_events_url":"https://api.github.com/users/sergeantjonas/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-06-08T12:49:17Z","updated_at":"2015-06-08T18:32:35Z","closed_at":null,"body":"I recently changed my application to use pjax requests, but today I stumbled upon an issue while using inline javascript ($this->registerJS). The javascript is not being executed as it's wrapped in a document.ready. After doing some digging it appears the root cause lies all the way in the web/View.php file.\r\n\r\nLine 565 has the following:\r\n````php\r\n$js = \"jQuery(document).ready(function () {\\n\" . implode(\"\\n\", $this->js[self::POS_READY]) . \"\\n});\";\r\n````\r\n\r\nIt should be:\r\n\r\n````php\r\n$js = \"jQuery(document).on('ready pjax:end', function () {\\n\" . implode(\"\\n\", $this->js[self::POS_READY]) . \"\\n});\";\r\n````\r\n\r\nBut then even if no PJAX is being used the pjax:end will be there, although I don't think that causes issues, there is probably a cleaner fix (checking for the PJAX request header?)\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/yiisoft/yii2/issues/comments/110100888","html_url":"https://github.com/yiisoft/yii2/issues/8702#issuecomment-110100888","issue_url":"https://api.github.com/repos/yiisoft/yii2/issues/8702","id":110100888,"user":{"login":"samdark","id":47294,"avatar_url":"https://avatars.githubusercontent.com/u/47294?v=3","gravatar_id":"","url":"https://api.github.com/users/samdark","html_url":"https://github.com/samdark","followers_url":"https://api.github.com/users/samdark/followers","following_url":"https://api.github.com/users/samdark/following{/other_user}","gists_url":"https://api.github.com/users/samdark/gists{/gist_id}","starred_url":"https://api.github.com/users/samdark/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/samdark/subscriptions","organizations_url":"https://api.github.com/users/samdark/orgs","repos_url":"https://api.github.com/users/samdark/repos","events_url":"https://api.github.com/users/samdark/events{/privacy}","received_events_url":"https://api.github.com/users/samdark/received_events","type":"User","site_admin":false},"created_at":"2015-06-08T18:32:35Z","updated_at":"2015-06-08T18:32:35Z","body":"https://github.com/yiisoft/yii2/issues/4814"}}