You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@myfaces.apache.org by "Volodymyr Siedlecki (Jira)" <de...@myfaces.apache.org> on 2024/10/30 15:50:00 UTC
[jira] [Commented] (MYFACES-4683) Scripts executed in reverse order during ajax event
[ https://issues.apache.org/jira/browse/MYFACES-4683?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17894271#comment-17894271 ]
Volodymyr Siedlecki commented on MYFACES-4683:
----------------------------------------------
Looks like this was fixed: [https://github.com/search?q=repo%3Aapache%2Fmyfaces+MYFACES-4683&type=pullrequests]
I'll close it out for the 4.1.0-RC3 release notes.
> Scripts executed in reverse order during ajax event
> ---------------------------------------------------
>
> Key: MYFACES-4683
> URL: https://issues.apache.org/jira/browse/MYFACES-4683
> Project: MyFaces Core
> Issue Type: Bug
> Components: General
> Affects Versions: 4.1.0-RC2
> Environment: Windows, Chrome
> Reporter: Jamie Goodfellow
> Assignee: Werner Punz
> Priority: Major
> Fix For: 5.0.0, 4.0.3, 4.1.0-RC3
>
>
> When myfaces handles an ajax request, the script tags of the rendered xhtml fragments are executed from last to first which is the opposite of what would happen during a regular page load. I encountered this problem because one of my components references another component in it's constructor and the referenced component didn't exist yet during an ajax call because of reverse execution. I found the problem code:
> .sort((node1, node2) => node1.compareDocumentPosition(node2) - 3) // preceding 2, following == 4)
> The compareDocumentPosition method compares the node2 position relative to node1's position. If node2 is preceding node1 then the sort return value should be 1 but in this case it will be -1 as 2 (return of compareDocumentPosition) minus 3 is -1. The correct code should be:
> .sort((node1, node2) => node2.compareDocumentPosition(node1) - 3) // preceding 2, following == 4)
> Here is a jsfiddle - [JSFiddle - Code Playground|https://jsfiddle.net/jc03vLt5/]
>
--
This message was sent by Atlassian Jira
(v8.20.10#820010)