{"action":"created","issue":{"url":"https://api.github.com/repos/processwire/processwire-issues/issues/103","repository_url":"https://api.github.com/repos/processwire/processwire-issues","labels_url":"https://api.github.com/repos/processwire/processwire-issues/issues/103/labels{/name}","comments_url":"https://api.github.com/repos/processwire/processwire-issues/issues/103/comments","events_url":"https://api.github.com/repos/processwire/processwire-issues/issues/103/events","html_url":"https://github.com/processwire/processwire-issues/issues/103","id":192518898,"number":103,"title":"Inline Javascript is not interpreted when Repeater is AJAX-loaded","user":{"login":"Toutouwai","id":1538852,"avatar_url":"https://avatars.githubusercontent.com/u/1538852?v=3","gravatar_id":"","url":"https://api.github.com/users/Toutouwai","html_url":"https://github.com/Toutouwai","followers_url":"https://api.github.com/users/Toutouwai/followers","following_url":"https://api.github.com/users/Toutouwai/following{/other_user}","gists_url":"https://api.github.com/users/Toutouwai/gists{/gist_id}","starred_url":"https://api.github.com/users/Toutouwai/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Toutouwai/subscriptions","organizations_url":"https://api.github.com/users/Toutouwai/orgs","repos_url":"https://api.github.com/users/Toutouwai/repos","events_url":"https://api.github.com/users/Toutouwai/events{/privacy}","received_events_url":"https://api.github.com/users/Toutouwai/received_events","type":"User","site_admin":false},"labels":[{"id":447576795,"url":"https://api.github.com/repos/processwire/processwire-issues/labels/resolution:%20not%20a%20bug","name":"resolution: not a bug","color":"cccccc","default":false},{"id":450125503,"url":"https://api.github.com/repos/processwire/processwire-issues/labels/status:%20discussion","name":"status: discussion","color":"c2e0c6","default":false}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":5,"created_at":"2016-11-30T09:44:06Z","updated_at":"2016-12-11T22:39:02Z","closed_at":"2016-12-11T05:11:23Z","body":"<!--\r\nIf you want your bug report\r\n* to be more difficult to process and understand\r\n* to have many unnecessary follow-up questions\r\n* to take longer to fix then necessary\r\ndon’t use this issue template.\r\n\r\nIf you want your bug report \r\n* to be concise and easy to understand\r\n* to not have any (or very few) follow-up questions\r\n* to take faster to fix\r\nuse this issue template. Thank you.\r\n-->\r\n\r\n### Short description of the issue\r\n\r\nWhen inputfields are rendered in a Repeater item that is dynamically loaded (AJAX), any inline Javascript is not interpreted. This is a problem for inputfields that are customised with Javascript added in a render hook. Or any inputfield that might include Javascript in its render method.\r\n\r\n### Expected behavior\r\n\r\nInline Javascript is interpreted for fields that are AJAX-loaded according to field visibility settings (Closed + load only when opened). Expectation is that AJAX-loaded Repeater items would be the same.\r\n\r\n### Actual behavior\r\n\r\nInline Javascript is not interpreted.\r\n\r\n### Steps to reproduce the issue\r\n<!-- Provide an unambiguous set of steps to reproduce the issue. -->\r\n\r\nMy case involves a module that appends Javascript to image fields to allow for easy insertion into CKEditor fields. But take a simple example hook:\r\n\r\n```\r\n$this->addHookAfter('InputfieldText::render', function($event) {\r\n    $out = \"<script>console.log('Field was rendered');</script>\";\r\n    $event->return .= $out;\r\n});\r\n```\r\n\r\nThis hook will log a message to the console when a text field is rendered normally. It also works when a text field is AJAX-loaded: the script is interpreted when the field loads and the message is logged. But the script is not interpreted when the field is rendered in an AJAX-loaded Repeater item. Not sure why this should be. \r\n\r\n### Setup/Environment\r\n<!--\r\n* Include as many relevant details about your environment setup as possible.\r\n* Hint: Using the Tracy Debugger module makes this a breeze: https://processwire.com/blog/posts/introducing-tracy-debugger/#versions-list\r\n-->\r\n\r\n* ProcessWire version: 3.0.42\r\n"},"comment":{"url":"https://api.github.com/repos/processwire/processwire-issues/issues/comments/266313773","html_url":"https://github.com/processwire/processwire-issues/issues/103#issuecomment-266313773","issue_url":"https://api.github.com/repos/processwire/processwire-issues/issues/103","id":266313773,"user":{"login":"owzim","id":1720088,"avatar_url":"https://avatars.githubusercontent.com/u/1720088?v=3","gravatar_id":"","url":"https://api.github.com/users/owzim","html_url":"https://github.com/owzim","followers_url":"https://api.github.com/users/owzim/followers","following_url":"https://api.github.com/users/owzim/following{/other_user}","gists_url":"https://api.github.com/users/owzim/gists{/gist_id}","starred_url":"https://api.github.com/users/owzim/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/owzim/subscriptions","organizations_url":"https://api.github.com/users/owzim/orgs","repos_url":"https://api.github.com/users/owzim/repos","events_url":"https://api.github.com/users/owzim/events{/privacy}","received_events_url":"https://api.github.com/users/owzim/received_events","type":"User","site_admin":false},"created_at":"2016-12-11T22:39:02Z","updated_at":"2016-12-11T22:39:02Z","body":"I am glad, that I am not the only one needing this to work. "}}
{"actor":{"display_login":"owzim"}}