CodePadApp / codepad-issues

Issue tracker for CodePad
https://codepad.app
4 stars 0 forks source link

Unable to create or run pads on iPad, or on Mac running Safari #59

Closed stevenwhiz closed 2 years ago

stevenwhiz commented 2 years ago

Try to create or run a pad on Mac running Safari, or on iPad running Safari or Chrome. Only the CodePad header appears and the rest of the screen is blank.

The code is failing on codepad.js, function updateJavaPackageWarning on the line: codeWithoutComments = codeWithoutComments.replaceAll(/\/\/.*|\/\*(.|\n)*?\*\/|("(?:(?<!\\)(?:\\\\)*\\"|[^\r\n"])*")/g, '$2').trim(); Error: Invalid regular expression: invalid group specifier name

It appears Safari and Chrome on iPad does not support the regex's lookbehind. See: https://stackoverflow.com/questions/51568821/works-in-chrome-but-breaks-in-safari-invalid-regular-expression-invalid-group

This is considered a JavaScript syntax error so it cannot be fixed with a try/catch block or browser detection because it fails on parsing.

ethan-vanderheijden commented 2 years ago

Closed with https://github.com/CodePadSite/codepad/pull/153