Modified custom property given back from getPropertyValue in some cases

225 Views Asked by At

I found a weired problem when working with custom properties. Definition in css file:

--testprop: /test/01234;

When I access this property by calling

const style = window.getComputedStyle(window.document.body);
const testprop = style.getPropertyValue('--testprop');

the string value of testprop is set to /test/1234.

This means the characters /0 are parsed browser internally to /.

When the custom property is defined like so:

--testprop: '/test/01234';

the javascript access results in a string value of "/test/01234" (something I expect).

Used browser: Chrome Version 97.0.4692.71 (Offizieller Build) (64-Bit)

Do I miss something here? I wouldn't expect the rewriting of /0 in any circumstances.

1

There are 1 best solutions below

0
Peter Vogel On

In fact this kind of problem is referenced in an existing bug report:

https://bugs.chromium.org/p/chromium/issues/detail?id=661854