Comments (14)
I did a quick test, which appeared to be like you said. The comment on that line would be wrong, but the behavior seems to be correct.
If that's true, I think we should leave it as synchronous, and just change the comment. That behavior would reflect how a new page would be parsed, which is by default synchronous.
from pjax.
No specific reason. Please contribute.
Note that current master seems to be in a broken state due to a refactoring (one big untested file to several small tested pieces).
If you want to make a PR, please do that on the current master following the "in-progress" refactoring :)
from pjax.
Sounds good! Thanks. Will check back for the refactoring.
from pjax.
Reopening to remember to handle that.
from pjax.
@joshkadis @MoOx
Is this fixed by 09f14fc?
from pjax.
No idea.
from pjax.
from pjax.
I'm sorry I've just seen it a short while ago.
The problem here is, that external scripts are loaded asynchronously.
So we would need another event to give inline-scripts the possibility to react on that.
This however needs promises or multiple callbacks.
This library should be without any dependancies and thus i couldn't just add Promises.
from pjax.
@lacrioque It's been a while but I vaguely recall having solved this somehow. I will have some free time starting next week to remember what this is all about.
🚀 time travel back to 2015
from pjax.
Whilst looking into #117, I noticed that lib/eval-script.js
claims to force inline external scripts to execute asynchronously, but actually forces them to be synchronous:
Line 21 in 09f14fc
Does this not mean that, assuming the script tags in the new document being switched are written in the correct order (i.e. inline scripts that depend on external script dependencies come after the external dependency script tag) as per @joshkadis' original example, this should be fixed? Inline script tags are parsed in the order in which they are found in the new document, so the source ordering should remain as intended.
I haven't tested this assertion yet, but will aim to try and do so.
from pjax.
I have actually just changed that comment in #118, so maybe that's all we need to do to close this 😄
from pjax.
@joshkadis @lacrioque Is there anything we're missing here?
from pjax.
@joshkadis @lacrioque I'm going to assume for now that this was fixed by 09f14fc, and the comment was just backwards (and was fixed in #118).
If that's incorrect, please let us know and we can reopen this.
from pjax.
I am still having this problem if the new request fragment has something like this:
<script src='/javascript/external.js'></script>
<script>
externalDefinedVariable();
</script>
The script "/javascript/external.js" is still being loaded asynchronously. I will try to investigate it deeper, but some hints would be helpful :)
from pjax.
Related Issues (20)
- Make X-PJAX headers optional HOT 1
- Fix testing(example) folder JS paths
- what meaning of analytics options ? HOT 1
- Not working with React event handlers HOT 1
- different script for different pages? HOT 2
- adding title to selectors results in full page loading HOT 2
- Pjax doesn't work with links loaded with another children ajax elements after DOM
- The hash value of url change to 'undefined' when click the browser prev or next page
- Some events are added repeatedly HOT 1
- How to cancel Pjax triggers if in the url # HOT 1
- "Before Send" Event? HOT 1
- How to find out whether PJax is property configured?
- Drop down menu
- unable to use pjax with express
- I want you to optimize your coding experience HOT 1
- Support for formaction attribute?
- Pjax can work incorrectly when manually calling functions in History HOT 1
- Is there a way for the page to uninstall PJAX?
- Can I still use pjax if I break and change some requests by ServiceWorker?
- constantly request 404 page when local develop my blog with Hexo+butterfly
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pjax.