jsonschema icon indicating copy to clipboard operation
jsonschema copied to clipboard

v1.4.1 does not support chrome 49

Open bingcoder opened this issue 2 years ago • 4 comments

v1.4.1 add regexp /^("(?:[!#-[]-\u{10FFFF}]|\[\t -\u{10FFFF}])...$/u not support chrome 49

'idn-email': /^("(?:[!#-\[\]-\u{10FFFF}]|\\[\t -\u{10FFFF}])*"|[!#-'*+\-/-9=?A-Z\^-\u{10FFFF}](?:\.?[!#-'*+\-/-9=?A-Z\^-\u{10FFFF}])*)@([!#-'*+\-/-9=?A-Z\^-\u{10FFFF}](?:\.?[!#-'*+\-/-9=?A-Z\^-\u{10FFFF}])*|\[[!-Z\^-\u{10FFFF}]*\])$/u

Whether to abandon support for Chrome 49?

Thanks

bingcoder avatar May 27 '22 10:05 bingcoder

@bingcoder Please provide the error.

Chrome 49 is old, I'm not sure how I would test back that far.

awwright avatar May 27 '22 15:05 awwright

We have the same problem, but in IE11 (Outlook unfortunately still uses IE to render add-ins in many configurations).

The error is just SyntaxError in regular expression, apparently because IE/the old Chrome don't support /u for regexes. In the IE dev-console /1/u.test("1") has the same error as simple test.

ayonix avatar Jun 29 '22 12:06 ayonix

Since this is potentially an easy fix I'll take a look at it... It might be possible to rewrite this so it uses surrogate pairs.

@bingcoder @ayonix If you change it so it reads:

'idn-email': /^("(?:[!#-\[\]-\uFFFF]|\\[\t -\uFFFF])*"|[!#-'*+\-/-9=?A-Z\^-\uFFFF](?:\.?[!#-'*+\-/-9=?A-Z\^-\uFFFF])*)@([!#-'*+\-/-9=?A-Z\^-\uFFFF](?:\.?[!#-'*+\-/-9=?A-Z\^-\uFFFF])*|\[[!-Z\^-\uFFFF]*\])$/

Does that work for you?

awwright avatar Jul 01 '22 01:07 awwright

That regex alone seems to work, in 1.4.1 are more issues for IE though. When i replace the regex with yours, the next complaint of it is: SCRIPT5021: Invalid range in character set which seems to be the [~-\u{10FFFF}] in iri-reference. Also there are more /u flags on regexes: iri-reference,uri-template,json-pointer,relative-json-pointer and maybe something else I've missed. Thanks for looking into it :)

ayonix avatar Jul 01 '22 06:07 ayonix