-
-
Notifications
You must be signed in to change notification settings - Fork 6.9k
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
Should Pjax be always registering javascript? #6917
Comments
Are you registering the inline javascript? You could move the |
The problem is in 3rd party code (widgets) that I do not have control of. They generate both inline javascript and register additional script files, which I ideally would like to avoid. |
I have the same problem. I use 3rd party code widgets and i would like to avoid register js for every case :s |
Fixed in yiisoft/jquery-pjax#30 |
@SilverFire does it really fix this issue? I looked briefly through the commit / discussion, but it seems to be mostly related to the order of script execution. Whereas this issue is about having an option to avoiding loading scripts altogether. How does this patch help me achieve such a behaviour? |
@nirvana-msu Sorry, it seems I didn't get you idea correctly from the first read. The patch does the following:
|
@nirvana-msu Following best practices, inline scripts should only initialize plugins, loaded in separated resource files and affect only the block, you load dynamically. Maybe I'll fix the problem with multiple loading of scripts, but I think we should do nothing special to inline JS - it should be just executed. |
Since now JavaScripts load through PJAX will be processed by |
Spent quite a bit of time debugging an issue today. I was rendering a partial view in response to pjax request using
renderPartial()
and was surprised to see that some inline javascript was registered. Turned out this is becausePjax
widget always executes$view->endBody();
and other similarView
methods. Sometimes you may want to handle javascript on your own, especially for ajax updates of complexListView
widgets. I think it would be useful if it was possible to choose whether javascript should be registered during pjax request or not, just like you can choose so by usingrenderPartial()
/renderAjax()
during a normal ajax requestThe text was updated successfully, but these errors were encountered: