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

Array.sort(compareFn) Not Working in Some Browsers #519

Open
robertology opened this issue Feb 18, 2024 · 1 comment
Open

Array.sort(compareFn) Not Working in Some Browsers #519

robertology opened this issue Feb 18, 2024 · 1 comment

Comments

@robertology
Copy link

Looks like Chromium based browsers (but not Safari) do not handle the callback function given to array.sort().

This was discovered from
https://codepen.io/htmx/pen/BamPGPE?editors=1101

Note: sort() without the callback function works as expected.

<button _="on click set x to [5, 9, 1] then log x.sort(\ a, b -> a > b)">Test</button>

Expected result: [1,5,9]

Actual results (on MacOS 14.3.1):

✅ Firefox 122.0.1: [1,5,9]
✅ Safari 17.3.1: [1,5,9]
❌ Chrome 120.0.6099.216: [5,9,1]
❌ Chrome 121.0.6167.184: [5,9,1]
❌ Brave 1.62.165 Chromium: 121.0.6167.184: [5,9,1]

@KDreynolds
Copy link

I can look into this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants