Repository navigation
Conversation
`get_attributes` only counted elements with a hyphen in their name as custom elements, so a spread on `<button is="...">` wrote strings with `setAttribute` and removed null values instead of calling the setter. It now also checks for an `is` attribute, like the compiler does. The `value`/`__value` branch keeps running for elements without a hyphen, so customized built-in options and inputs keep their value handling.
|
Install the latest version of pnpm add https://pkg.svelte.dev/svelte/c/e36837fc14b79e35d67fc35e9f5c20ec9ab69815Open in Note This PR is from a fork. A maintainer must approve approve each commit before it can be built and installed. |
🦋 Changeset detectedLatest commit: e36837f The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #19034
When a customized built-in like
<button is="fancy-button">gets its props through a spread,get_attributesdoesn't count it as a custom element, because it only checks the node name for a hyphen. So strings are written as attributes, null removes the attribute, and the element's setter never runs. Without a spread, the compiler already treats elements with anisattribute as custom elements, so the same props reach the setter throughset_custom_element_data.The custom element check now also looks for an
isattribute. The__valuebranch keeps running for elements without a hyphen, since custom elements are only skipped there because Lit keeps its own value in that property. Without that, a select bound to spread option values that are objects gets the string "[object Object]", and typing "250.5" into a spread number input that is a customized built-in ends up as "5250".Added a
runtime-runestest with a customized built-in button that gets its label with and without a spread, including an update to null, and a select bound to customized built-in options with spread object values. On main it fails at the first spread assertion, and with only the custom element check changed it fails at the select. It passes with the change. The full test suite (7897 passed), lint and type check pass too.Before submitting the PR, please make sure you do the following
feat:,fix:,chore:, ordocs:.packages/svelte/src, add a changeset (npx changeset).Tests and linting
pnpm testand lint the project withpnpm lint