From cced079a1cfaff875052f341740860d1f6448388 Mon Sep 17 00:00:00 2001 From: Aron Griffis Date: Sun, 25 Apr 2021 22:30:08 -0400 Subject: [PATCH] fix(transform): IE11 doesn't support dotAll (#247) --- packages/core/src/transform.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/packages/core/src/transform.ts b/packages/core/src/transform.ts index 77c23cd8..ec3c64cb 100644 --- a/packages/core/src/transform.ts +++ b/packages/core/src/transform.ts @@ -6,7 +6,8 @@ import { propGetters } from './propGetters' const PROP_CHAR = `[-\\w]` // prop value consists of non-semis and no curly braces unless backslash-escaped. -const VALUE_CHAR = `(?:\\\\.|[^\\\\;{}])` +// This uses [\s\S] instead of . because IE11 doesn't support the s flag. +const VALUE_CHAR = `(?:\\\\[\\s\\S]|[^\\\\;{}])` // prettier-ignore const PROP_PATT = ( @@ -29,7 +30,7 @@ const MEDIA_PATT = ( `(\\s*\\{)` // brace & whitespace ) -const MATCH_REGEXP = new RegExp(`(?:${PROP_PATT}|${MEDIA_PATT})`, `gs`) +const MATCH_REGEXP = new RegExp(`(?:${PROP_PATT}|${MEDIA_PATT})`, `g`) export function transform(rawValue: any): any { if (typeof rawValue !== 'string') return rawValue @@ -68,7 +69,7 @@ const QUERY_REGEXP = new RegExp( `(\\s*:\\s*)` + // colon & whitespace `([^\\)]*?)` + // capture prop value (non-greedy) `(\\s*\\))`, // close paren, whitespace - `gs` + `g` ) function mediaTransform(rawValue: string) {