Skip to content

Resize observer contentBoxSize binding is undefined #8583

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
DanielKerrigan opened this issue May 12, 2023 · 2 comments
Closed

Resize observer contentBoxSize binding is undefined #8583

DanielKerrigan opened this issue May 12, 2023 · 2 comments

Comments

@DanielKerrigan
Copy link

DanielKerrigan commented May 12, 2023

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

@Rich-Harris
Copy link
Member

Closing since this is fixed in Svelte 5

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants