honojs / hono

Web framework built on Web Standards
https://hono.dev
MIT License
18.65k stars 523 forks source link

Unable to use honox-island before iOS 16.4 due to Safari is not supoorted lookbehind regex. #2517

Closed mrtska closed 5 months ago

mrtska commented 5 months ago

What version of Hono are you using?

4.0.5 (latest honox uses this version)

What runtime/platform is your app running on?

iOS 16.3 or lower

What steps can reproduce the bug?

Prepare a iOS 16.3 or lower iOS device.

Access the website which created with honox island component (e.g. honox-samples).

Errors occurred in browser console:

Unhandled Promise Rejection: SyntaxError: Invalid regular expression: invalid group specifier name

I haven't tested it without honox. Sorry.

What is the expected behavior?

No error occurred.

What do you see instead?

hono/jsx uses lookbehind regex in JavaScipt.

https://github.com/honojs/hono/blob/13c3156c67414fdb43ce30d6ce74f3ab1c349305/src/jsx/dom/render.ts#L93

It is not supported by iOS 16.3 or lower.

https://caniuse.com/js-regexp-lookbehind

To resolve this issue, we need to rewrite regex without lookbehind pattern as I think.

Additional information

I don't know about hono's compatibility policy for older devices or OS, if hono decides that this issue will not be resolved, I will follow your decision.👍

Everything else seemed to be working fine on iOS 15.4 I tested.

I think hono will be more compatible with older devices.

yusukebe commented 5 months ago

Hi @mrtska

Thank you for raising the issue. I didn't know there is a specification for iOS like that!

@usualoma Can you handle this?

usualoma commented 5 months ago

Hi @mrtska

Thanks for the report! I wasn't aware of this behaviour in iOS either. I will fix it in #2524.