From 62676d23d0b5457d23293746f673d9ac0b9abe07 Mon Sep 17 00:00:00 2001 From: Jonas Geiler Date: Sat, 20 Apr 2024 20:48:29 +0200 Subject: [PATCH] fix: default to px when width/height is a number --- src/VirtualList.svelte | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/VirtualList.svelte b/src/VirtualList.svelte index 762cf9c..33d36ac 100644 --- a/src/VirtualList.svelte +++ b/src/VirtualList.svelte @@ -197,10 +197,12 @@ const totalSize = sizeAndPositionManager.getTotalSize(); if (scrollDirection === DIRECTION.VERTICAL) { - wrapperStyle = `height:${height};width:${width};`; + const unit = typeof height === 'number' ? 'px' : ''; + wrapperStyle = `height:${height}${unit};width:${width};`; innerStyle = `flex-direction:column;height:${totalSize}px;`; } else { - wrapperStyle = `height:${height};width:${width}`; + const unit = typeof width === 'number' ? 'px' : ''; + wrapperStyle = `height:${height};width:${width}${unit}`; innerStyle = `min-height:100%;width:${totalSize}px;`; }