Skip to content
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

Undefined can clear checked and value properties for custom elements #3813

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

objerke
Copy link

@objerke objerke commented Nov 23, 2022

This pull requests makes it possible to reset the value and checked properties on a custom element, by passing undefined as a prop value. Tests are added with the new behavior.

This is a follow up on #2472 which slightly altered the behavior of #2465 in terms of undefined values. Currently an undefined value is never set for the value and checked properties.

it(`should clear existing 'value' property with ""`, () => {
    render(<test-component value={{ foo: 'bar' }} />, scratch);

    render(<test-component value={undefined} />, scratch);

    expect(scratch.querySelector('test-component').value).to.equal("");
});

We are using preact to render custom elements that uses properties to pass down data. The value can be cleared as a way to indicate an indeterminate state. I think it feels natural to allow the value and checked properties to function as any other property when it comes to custom elements.

@github-actions
Copy link

📊 Tachometer Benchmark Results

Summary

A summary of the benchmark results will show here once they finish.

Results

The full results of your benchmarks will show here once they finish.

tachometer-reporter-action v2 for Benchmarks

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

Successfully merging this pull request may close these issues.

None yet

1 participant