From a507ab564e01b76a55902aa20da65e4a7d79f039 Mon Sep 17 00:00:00 2001 From: David Bauske Date: Fri, 20 Oct 2017 14:59:35 +0200 Subject: [PATCH] Added support for decimal numbers in scroll-snap-destination. Trailing dots are allowed, leading dots aren't. --- src/scrollsnap-polyfill.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/scrollsnap-polyfill.js b/src/scrollsnap-polyfill.js index d46f4ad..af675d0 100644 --- a/src/scrollsnap-polyfill.js +++ b/src/scrollsnap-polyfill.js @@ -438,7 +438,7 @@ */ function parseSnapCoordValue(declaration) { // regex to parse lengths - var regex = /(\d+)(px|%) (\d+)(px|%)/g, + var regex = /(\d+(?:\.\d*)?)(px|%) (\d+(?:\.\d*))(px|%)/g, // defaults parsed = {y: {value: 0, unit: 'px'}, x: {value: 0, unit: 'px'}},