]> source.dussan.org Git - jquery.git/commit
CSS: Return `undefined` for whitespace-only CSS variable values (#5120)
authorMichał Gołębiowski-Owczarek <m.goleb@gmail.com>
Mon, 3 Oct 2022 16:10:42 +0000 (18:10 +0200)
committerMichał Gołębiowski-Owczarek <m.goleb@gmail.com>
Mon, 3 Oct 2022 20:45:52 +0000 (22:45 +0200)
commit8bea1dec18da3f3a02751dc226d51b9d0546b49e
tree8de981409873ee793d6d6a1d46dbcbca06c17a97
parent9eb47ccebadce47908b10cc519acf619957b64a4
CSS: Return `undefined` for whitespace-only CSS variable values (#5120)

The spec requires that CSS variable values are trimmed. In browsers that do
this - mainly, Safari, but also Firefox if the value only has leading
whitespace - we currently return undefined; in other browsers, we return
an empty string as the logic to fall back to undefined happens before
trimming.

This commit adds another explicit callback to `undefined` to have it consistent
across browsers.

Also, more explicit comments about behaviors we need to work around in various
browsers have been added.

Closes gh-5120
Ref gh-5106

(cherry picked from commit 7eb0019640a5856c42b451551eb7f995d913eba9)
src/css/curCSS.js
test/unit/css.js