Description
Describe the bug
I am trying to use the new resize observer bindings that were released in 3.59.0. bind:borderBoxSize
is working as expected, but I have not been able to get bind:contentBoxSize
to work. Its value stays undefined. I've tested in Safari, Chrome, and Firefox on macOS.
I'm not familiar with the Svelte codebase, but I wonder if the issue might be in these lines:
{
event_names: ['elementresizecontentbox'],
filter: (_node: Element, name: string) =>
regex_content_rect.test(name) ?? regex_content_box_size.test(name)
},
I think the check should be regex_content_rect.test(name) || regex_content_box_size.test(name)
. The regex test()
method returns either true or false. The righthand side of ??
is only evaluated if the lefthand side is null or undefined, which can't happen here. I would be happy to submit a PR if this is the fix.
Reproduction
REPL demo showing that bind:borderBoxSize
works, but bind:contentBoxSize
does not.
Logs
No response
System Info
System:
OS: macOS 13.2.1
CPU: (8) arm64 Apple M1
Memory: 53.31 MB / 16.00 GB
Shell: 5.8.1 - /bin/zsh
Binaries:
Node: 18.9.0 - ~/.nvm/versions/node/v18.9.0/bin/node
Yarn: 3.5.1 - ~/.nvm/versions/node/v18.9.0/bin/yarn
npm: 8.19.1 - ~/.nvm/versions/node/v18.9.0/bin/npm
Browsers:
Chrome: 113.0.5672.92
Firefox: 112.0.2
Safari: 16.3
npmPackages:
svelte: ^3.59.0 => 3.59.1
Severity
annoyance