Giter Site home page Giter Site logo

Comments (14)

BehindTheMath avatar BehindTheMath commented on May 18, 2024 1

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.

MoOx avatar MoOx commented on May 18, 2024

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.

joshkadis avatar joshkadis commented on May 18, 2024

Sounds good! Thanks. Will check back for the refactoring.

from pjax.

MoOx avatar MoOx commented on May 18, 2024

Reopening to remember to handle that.

from pjax.

BehindTheMath avatar BehindTheMath commented on May 18, 2024

@joshkadis @MoOx
Is this fixed by 09f14fc?

from pjax.

MoOx avatar MoOx commented on May 18, 2024

No idea.

from pjax.

BehindTheMath avatar BehindTheMath commented on May 18, 2024

@lacrioque ?

from pjax.

lacrioque avatar lacrioque commented on May 18, 2024

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.

joshkadis avatar joshkadis commented on May 18, 2024

@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.

robinnorth avatar robinnorth commented on May 18, 2024

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:

script.async = false; // force asynchronous loading of peripheral js

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.

robinnorth avatar robinnorth commented on May 18, 2024

I have actually just changed that comment in #118, so maybe that's all we need to do to close this 😄

from pjax.

BehindTheMath avatar BehindTheMath commented on May 18, 2024

@joshkadis @lacrioque Is there anything we're missing here?

from pjax.

BehindTheMath avatar BehindTheMath commented on May 18, 2024

@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.

lneves12 avatar lneves12 commented on May 18, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.