From 22f7be9e018cac9143c8dcb6fbe9597bf59c54ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=89=E5=92=B2=E6=99=BA=E5=AD=90?= Date: Thu, 29 Sep 2022 19:26:27 +0800 Subject: [PATCH 1/3] fix(shared): multi line style --- packages/shared/src/normalizeProp.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/shared/src/normalizeProp.ts b/packages/shared/src/normalizeProp.ts index cab8090692e..9069bbb89e7 100644 --- a/packages/shared/src/normalizeProp.ts +++ b/packages/shared/src/normalizeProp.ts @@ -28,7 +28,7 @@ export function normalizeStyle( } const listDelimiterRE = /;(?![^(]*\))/g -const propertyDelimiterRE = /:(.+)/ +const propertyDelimiterRE = /:(.+)/s export function parseStringStyle(cssText: string): NormalizedStyle { const ret: NormalizedStyle = {} From 615fbc2b74d361e1b0ea2575d05d0832e6794b06 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=89=E5=92=B2=E6=99=BA=E5=AD=90?= Date: Mon, 3 Oct 2022 15:53:26 +0800 Subject: [PATCH 2/3] test: add test --- .../shared/__tests__/normalizeProp.spec.ts | 29 ++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/packages/shared/__tests__/normalizeProp.spec.ts b/packages/shared/__tests__/normalizeProp.spec.ts index c884d9e7281..4ef69503f04 100644 --- a/packages/shared/__tests__/normalizeProp.spec.ts +++ b/packages/shared/__tests__/normalizeProp.spec.ts @@ -1,4 +1,4 @@ -import { normalizeClass } from '../src' +import { normalizeClass, parseStringStyle } from '../src' describe('normalizeClass', () => { test('handles string correctly', () => { @@ -16,4 +16,31 @@ describe('normalizeClass', () => { 'foo baz' ) }) + + // #6777 + test('parse multi-line inline style', () => { + expect( + parseStringStyle(`border: 1px solid transparent; + background: linear-gradient(white, white) padding-box, + repeating-linear-gradient( + -45deg, + #ccc 0, + #ccc 0.5em, + white 0, + white 0.75em + );`) + ).toMatchInlineSnapshot(` + Object { + "background": "linear-gradient(white, white) padding-box, + repeating-linear-gradient( + -45deg, + #ccc 0, + #ccc 0.5em, + white 0, + white 0.75em + )", + "border": "1px solid transparent", + } + `) + }) }) From 2a50d03e5c6a737a860de349e0df16743c654582 Mon Sep 17 00:00:00 2001 From: Evan You Date: Mon, 7 Nov 2022 22:14:14 -0500 Subject: [PATCH 3/3] Update packages/shared/src/normalizeProp.ts --- packages/shared/src/normalizeProp.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/shared/src/normalizeProp.ts b/packages/shared/src/normalizeProp.ts index 9069bbb89e7..a1263711c95 100644 --- a/packages/shared/src/normalizeProp.ts +++ b/packages/shared/src/normalizeProp.ts @@ -28,7 +28,7 @@ export function normalizeStyle( } const listDelimiterRE = /;(?![^(]*\))/g -const propertyDelimiterRE = /:(.+)/s +const propertyDelimiterRE = /:([^]+)/ export function parseStringStyle(cssText: string): NormalizedStyle { const ret: NormalizedStyle = {}