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

Order of <xf:action type="javascript"> and <xf:load> not respected #4195

Closed
avernet opened this issue Sep 25, 2019 · 4 comments
Closed

Order of <xf:action type="javascript"> and <xf:load> not respected #4195

avernet opened this issue Sep 25, 2019 · 4 comments

Comments

@avernet
Copy link
Collaborator

avernet commented Sep 25, 2019

Say you click on this button:

<xf:trigger>
    <xf:label>Script and load</xf:label>
    <xf:action event="DOMActivate">
        <xf:action type="javascript">console.log("Action");</xf:action>
        <xf:load resource="javascript:console.log('Load')"/>
    </xf:action>
</xf:trigger>

On the console, you'll get "Load" then "Action", while the reverse would be expected. ("Load" then "Action" also corresponds to the order of the events in the Ajax response.)

@avernet avernet added this to To review in Orbeon Forms 2019.1 via automation Sep 25, 2019
@ebruchez
Copy link
Collaborator

For #3718, we had a similar issue related to xxf:submission, which we changed to be the last to run.

Here, we should do something similar, and have xxf:load run last, but only if it's not a javascript: load. If it is a JavaScript load, it should run interleaved with the other scripts.

@ebruchez ebruchez moved this from To review to To do in Orbeon Forms 2019.1 Sep 25, 2019
@avernet
Copy link
Collaborator Author

avernet commented Sep 26, 2019

@ebruchez ebruchez moved this from To do to In progress in Orbeon Forms 2019.1 Sep 27, 2019
@ebruchez
Copy link
Collaborator

ebruchez commented Oct 1, 2019

+1 from customer

@ebruchez
Copy link
Collaborator

ebruchez commented Oct 1, 2019

My first idea was to handle <xf:load resource="javascript:..."> the same way we handle <xf:action type="javascript">. In particular, add it to the list of static scripts so that all scripts are handled the same way.

The problem is that we can use AVTs in resource. We have one (obsolete) instance of this in our code, and we actually document this as well. But scripts don't have AVTs. They can only have parameters. So we cannot handle them exactly the same way.

So, for now, we have to keep handling JavaScript loads separately. But what we'll do is:

  • keep JavaScript loads invocations where they are now
  • move all other loads to the end

@ebruchez ebruchez added this to To do in Orbeon Forms 2018.2.4 via automation Oct 1, 2019
ebruchez added a commit that referenced this issue Oct 1, 2019
ebruchez added a commit that referenced this issue Oct 1, 2019
ebruchez added a commit that referenced this issue Oct 1, 2019
ebruchez added a commit that referenced this issue Oct 1, 2019
ebruchez added a commit that referenced this issue Oct 1, 2019
ebruchez added a commit that referenced this issue Oct 1, 2019
ebruchez added a commit that referenced this issue Oct 1, 2019
ebruchez added a commit that referenced this issue Oct 1, 2019
@ebruchez ebruchez moved this from To do to Done in Orbeon Forms 2018.2.4 Oct 1, 2019
@ebruchez ebruchez closed this as completed Oct 2, 2019
Orbeon Forms 2019.1 automation moved this from In progress to Done Oct 2, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
No open projects
Development

No branches or pull requests

2 participants