Skip to content

Conversation

@pavel-krasnov
Copy link

Hi, when running the package in old browsers (Chrome < 50) I get the error "Invalid flags supplied to RegExp constructor 'u'". This is because of this line of code:

const dataURI = /^data:image\/svg[^,]*?(;base64)?,(.*)/u.exec(src);

This feature (/u) is supported from Chrome 50: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp/unicode#browser_compatibility

Why could somebody need to support Chrome 50? I am developing a WebOS/Tizen web based app. Some not so old TV devices use these old Chrome versions under the hood to run apps:

As the main page of this repo effectively mentions support for Chrome 42+ (from which fetch is supported) or even older with fetch polyfill, it would be great to change the line to something processable in old browsers.

@codesandbox
Copy link

codesandbox bot commented Mar 27, 2025

Review or Edit in CodeSandbox

Open the branch in Web EditorVS CodeInsiders

Open Preview

@codesandbox-ci
Copy link

codesandbox-ci bot commented Mar 27, 2025

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit 521f3a1:

Sandbox Source
react-inlinesvg-demo Configuration

@pavel-krasnov pavel-krasnov force-pushed the regexp-old-chrome-support branch from 8bc179c to 521f3a1 Compare March 27, 2025 10:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant