chartjs / Chart.js

Simple HTML5 Charts using the <canvas> tag
https://www.chartjs.org/
MIT License
63.92k stars 11.89k forks source link

Error on IPHONE 5s running 12.9.7 #11724

Open BrianUK1234 opened 3 months ago

BrianUK1234 commented 3 months ago

Expected behavior

Screenshot 2024-03-28 at 14 19 24 I dont know if its to do with support for the static keyword but apparently that support was added IOS 9 It works fine on later versions of IPHONES and IOS, I know its an old phone, so not the end of the earth.

Current behavior

It generates a syntax error

Reproducible sample

Sent screen shot of syntax error

Optional extra steps/info to reproduce

[Error] SyntaxError: Unexpected token '='. Expected an opening '(' before a method's parameter list.

(anonymous function) (chart-full.js:3587)

the chart-full.js I expanded your min file as thats the only one I had, if you look at the screen shot hopefully you will recognise the code, I hope this helps

Possible solution

No response

Context

Just testing it on all the old phones I have available, it failed on an old one

chart.js version

v4,4.2

Browser name and version

Safari on IOS 12.9.7

Link to your project

No response

DAcodedBEAT commented 3 months ago

(I'm just a fellow user of this library but I think I found the issue) It looks like the provided code was not supported by the Javascript engine used on that platform.

According to https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes/Public_class_fields, it looks like public static fields was only supported as of Safari 14.1, which shipped with iOS & iPadOS 14.5 and macOS Big Sur 11.3 (from https://developer.apple.com/documentation/safari-release-notes/safari-14_1-release-notes).

Since the library is targeting ES6 (per https://github.com/chartjs/Chart.js/blob/v4.4.2/tsconfig.json#L31) and this was a bug in the implementation of the language spec for JavaScriptCore in Webkit (Safari), I wouldn't expect this to get fixed but who knows, maybe the maintainers of this project might be open to it 🤷

BrianUK1234 commented 3 months ago

(I'm just a fellow user of this library but I think I found the issue) It looks like the provided code was not supported by the Javascript engine used on that platform.

According to https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes/Public_class_fields, it looks like public static fields was only supported as of Safari 14.1, which shipped with iOS & iPadOS 14.5 and macOS Big Sur 11.3 (from https://developer.apple.com/documentation/safari-release-notes/safari-14_1-release-notes).

Since the library is targeting ES6 (per https://github.com/chartjs/Chart.js/blob/v4.4.2/tsconfig.json#L31) and this was a bug in the implementation of the language spec for JavaScriptCore in Webkit (Safari), I wouldn't expect this to get fixed but who knows, maybe the maintainers of this project might be open to it 🤷

Thanks Arun, for looking into it, It was an old phone, so your comments about safari are more than likely to be correct, I was just doing belt and braces testing. I wouldnt want anybody wasting time, but I thought I would flag it.

Thanks again

DAcodedBEAT commented 3 months ago

@chartjs do you all think this is worth fixing? what are the minimum supported target versions?

BrianUK1234 commented 2 months ago

In all honesty I mentioned it to give beck, I dont want any body to go to effort, Iphone 5's are now old and why limit the development of a super project, I can always go back to an earlier version of chart JS, but I dont think the demand is there

naptoon commented 1 month ago

I'm using an old iPad Air (iPadOS 12.5.7) and have the same issue. I need this iPad for just one purpose - to show a chart of my current power price. I wrote the code and used chart.js but it doesn't work on the old iPad. Now I will try the version 2 of chart.js.