Skip to content

Commit e620935

Browse files
committed
fix(transform): IE11 doesn't support dotAll (#247)
1 parent ee01b9b commit e620935

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

packages/core/src/transform.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ import { propGetters } from './propGetters'
66
const PROP_CHAR = `[-\\w]`
77

88
// prop value consists of non-semis and no curly braces unless backslash-escaped.
9-
const VALUE_CHAR = `(?:\\\\.|[^\\\\;{}])`
9+
// This uses [\s\S] instead of . because IE11 doesn't support the s flag.
10+
const VALUE_CHAR = `(?:\\\\[\\s\\S]|[^\\\\;{}])`
1011

1112
// prettier-ignore
1213
const PROP_PATT = (
@@ -29,7 +30,7 @@ const MEDIA_PATT = (
2930
`(\\s*\\{)` // brace & whitespace
3031
)
3132

32-
const MATCH_REGEXP = new RegExp(`(?:${PROP_PATT}|${MEDIA_PATT})`, `gs`)
33+
const MATCH_REGEXP = new RegExp(`(?:${PROP_PATT}|${MEDIA_PATT})`, `g`)
3334

3435
export function transform(rawValue: any) {
3536
if (typeof rawValue !== 'string') return rawValue
@@ -68,7 +69,7 @@ const QUERY_REGEXP = new RegExp(
6869
`(\\s*:\\s*)` + // colon & whitespace
6970
`([^\\)]*?)` + // capture prop value (non-greedy)
7071
`(\\s*\\))`, // close paren, whitespace
71-
`gs`
72+
`g`
7273
)
7374

7475
function mediaTransform(rawValue: string) {

0 commit comments

Comments
 (0)