Closed vpotter closed 3 years ago
Can someone find a regex that works with safari and suggest it here?
@jpic Any development on this?
I've read the comment, but since I've never used django-nested-admin I'm not sure I get it right.
What type of id's you'd like to exclude among the following:
100-empty-200
x-empty-y
test100-empty-1test
foo-100-empty-200-bar
What if we simpy check it like this: https://regex101.com/r/R8FLpq/1 ?
Or 2 expressions one to check if there no match for <digits>-empty-<digits>
AND there is match for -empty-
It breaks Safari for us as well :(
but I reverting to 3.8.1 - it is good with safari
If I understand the comments right:
-empty-
should return false
-foo-empty-bar-
should return false
-1-empty-2-
should return true
-foo-bar-
should return true
// return !this.id.match(/(?<!-\d+)-empty-(?!\d+-)/);
return !this.id.match(/-empty-/) || this.id.match(/-\d+-empty-\d+-/);
-empty-
matches the left side, is negated by the !
, and fails to match the right side, so the whole expression is false
-foo-empty-bar-
matches the left side, is negated by the !
, and fails to match the right side, so again, false
-1-empty-2-
matches the left side, is negated by the !
, and then does match the right side, so the whole expression is true
-foo-bar-
doesn't match the left side, so gets negated to true
by the !
, and the expression shortcircuits returning true
I replaced the Ajax version from 3.8.1 to resolve the issue
Any chance that a new version will be released soon to PyPI with this fix included? At the moment DAL is non-functional in Safari browsers (both desktop and mobile) for me.
Sure, anyone can confirm the current master is working in production for them?
It works for me!
(Safari 14.1 on macOS, and whatever the latest Safari is on iOS)
Thank you for your response!
Released 3.9.0rc1
On Sun, May 16, 2021 at 6:18 PM Phil Gyford @.***> wrote:
It works for me!
— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub https://github.com/yourlabs/django-autocomplete-light/issues/1226#issuecomment-841839277, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAAXDLAAVWD3PWL3TSRNPRLTN7V4VANCNFSM4Y56SVDQ .
-- ∞
Version: 3.8.2 Error: SyntaxError: Invalid regular expression: invalid group specifier name
https://github.com/yourlabs/django-autocomplete-light/blob/29b91077a9935feb640d13b13f0fdf9d2fdbf2b3/src/dal/static/autocomplete_light/autocomplete_light.js#L128
The error is caused by a look-behind regex assertion which is not supported by Safari (according to https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions#browser_compatibility)
The error is reproducible on both desktop & mobile.