Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Run <script> in containers when pjax loaded #4

Open
moeshin opened this issue Oct 10, 2021 · 2 comments
Open

Run <script> in containers when pjax loaded #4

moeshin opened this issue Oct 10, 2021 · 2 comments

Comments

@moeshin
Copy link

moeshin commented Oct 10, 2021

<body>
<script>alert('hi')</script>
</body>
Pjax.start({
    containers: ['body']
});
@brcontainer
Copy link
Owner

@moeshin Thanks for the helpful advice. When I created the library I thought of implementing this using documentgetElementsByTagNameScript, but at the time it seemed to me that it would be better to create an event to detect route changes, as in the example:

document.addEventListener("pjax:complete", function() {
  console.log("Event: pjax:complete", arguments);
});

I still intend to implement (it will be a feature that can be disabled). I will notify you shortly with the lib update.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants