From 6651fc6789d5902d171dc53b4094887870433018 Mon Sep 17 00:00:00 2001 From: Niklas von Hertzen Date: Thu, 5 Aug 2021 09:30:22 +0800 Subject: [PATCH] fix: none image (#2627) --- src/css/types/image.ts | 7 +++++-- tests/reftests/background/linear-gradient2.html | 1 + 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/css/types/image.ts b/src/css/types/image.ts index 7e4ae8d..ffb3a7e 100644 --- a/src/css/types/image.ts +++ b/src/css/types/image.ts @@ -94,12 +94,15 @@ export const image: ITypeDescriptor = { return imageFunction(context, value.values); } - throw new Error(`Unsupported image type`); + throw new Error(`Unsupported image type ${value.type}`); } }; export function isSupportedImage(value: CSSValue): boolean { - return value.type !== TokenType.FUNCTION || !!SUPPORTED_IMAGE_FUNCTIONS[value.name]; + return ( + !(value.type === TokenType.IDENT_TOKEN && value.value === 'none') && + (value.type !== TokenType.FUNCTION || !!SUPPORTED_IMAGE_FUNCTIONS[value.name]) + ); } const SUPPORTED_IMAGE_FUNCTIONS: Record ICSSImage> = { diff --git a/tests/reftests/background/linear-gradient2.html b/tests/reftests/background/linear-gradient2.html index 6547f2b..f552b89 100644 --- a/tests/reftests/background/linear-gradient2.html +++ b/tests/reftests/background/linear-gradient2.html @@ -46,6 +46,7 @@
+