MoOx / pjax

Easily enable fast Ajax navigation on any website (using pushState + xhr)
MIT License
1.43k stars 124 forks source link

A question about executeScripts #208

Open stevenjoezhang opened 5 years ago

stevenjoezhang commented 5 years ago

https://github.com/MoOx/pjax/blob/c26c223a652affd55677dd47619bc68017b8d5ca/index.js#L208-L213

https://github.com/MoOx/pjax/blob/c26c223a652affd55677dd47619bc68017b8d5ca/lib/execute-scripts.js#L10-L17

After script.parentNode.removeChild(script); is executed, script.parentNode will be null

https://github.com/MoOx/pjax/blob/c26c223a652affd55677dd47619bc68017b8d5ca/lib/eval-script.js#L4-L5

This means that the return value of the short-circuit evaluation here is document.querySelector("head")

In other words, all the scripts that are refreshed by pjax will be placed in the <head>. Is this expected behavior?