Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(transform): IE11 doesn't support dotAll (#247) #248

Merged
merged 1 commit into from
Apr 26, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions packages/core/src/transform.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 = (
Expand All @@ -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) {
if (typeof rawValue !== 'string') return rawValue
Expand Down Expand Up @@ -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) {
Expand Down