거의 알고리즘 일기장

pc chrome 렌더링은 정상적으로 되는데, ios chrome에서 렌더링이 안될때 - (SyntaxError: Invalid regular expression: invalid group specifier name) 본문

web

pc chrome 렌더링은 정상적으로 되는데, ios chrome에서 렌더링이 안될때 - (SyntaxError: Invalid regular expression: invalid group specifier name)

건우권 2021. 6. 12. 16:16

최근 chrome에서는 브라우저 랜더링이 정상적으로 되는데, ios에 있는 chrome에서 정상적으로 실행되지 않는 에러를 겪었다.

왜 그럴까 서칭을 해보니..

 

https://www.browserstack.com/guide/browser-rendering-engine

저 위의 그림과 같이 ios chrome은 다른 엔진을 쓴다..

 

그래서 에러의 원인을 찾기 위해서 ios chrome과 같은 엔진을 쓰는 safari에 있는 에러를 확인해 보았다.

SyntaxError: Invalid regular expression: invalid group specifier name

safari는 regex에서 lookbehind 문법을 지원하지 않는다.

new RegExp("(?<!:):(?!:)") //이거 safari 지원안됨

고쳤더니 바로 해결되었다.


정리

1. ios에 있는 chrome 엔진은 safari와 같은 webkit이다.

2. safari에서는 regex의 lookbehind 문법을 지원하지 않는다.

3. 그러므로 pc chrome이 되는데 ios chrome이 안된다면 safari를 켜서 에러를 확인해보자. (ios 브라우저 엔진은 다 webkit이다.)


참고

https://github.com/typesense/typesense-instantsearch-adapter/issues/29

 

Regex lookbehind in SearchRequestAdapter.js not supported in Safari · Issue #29 · typesense/typesense-instantsearch-adapter

Description We're seeing the following error in Safari: SyntaxError: Invalid regular expression: invalid group specifier name. The responsible code appears to be the lookbehind in the regex on ...

github.com

https://www.browserstack.com/guide/browser-rendering-engine

 

Role of Rendering Engines in Browsers | BrowserStack

Ever wondered how browsers serve requested content in a fraction of seconds? Dive-in to understand the role of browser engine as well as the rendering engine that makes it possible.

www.browserstack.com

 

반응형

'web' 카테고리의 다른 글

React 18 (Suspense를 이용한 ssr 아키텍처) 를 읽고  (0) 2021.06.20
git commit message convention  (0) 2021.06.13
브라우저 렌더링 과정  (0) 2021.06.08
jwt 로그인 방식  (2) 2021.06.04
react - code splitting  (1) 2021.06.04
Comments