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

fix: support camelCase properties on custom elements #9328

Merged
merged 4 commits into from
Oct 18, 2023
Merged

Conversation

dummdidumm
Copy link
Member

while attributes are case insensitive, properties are not. to not introduce a breaking change, the lowercased variant is checked first. fixes #9325

Svelte compiler rewrite

Please note that the Svelte codebase is currently being rewritten. Thus, it's best to hold off on new features or refactorings for the time being.

Before submitting the PR, please make sure you do the following

  • It's really useful if your PR references an issue where it is discussed ahead of time. In many cases, features are absent for a reason. For large changes, please create an RFC: https://github.com/sveltejs/rfcs
  • Prefix your PR title with feat:, fix:, chore:, or docs:.
  • This message body should clearly illustrate what problems it solves.
  • Ideally, include a test that fails without this PR but passes with it.

Tests and linting

  • Run the tests with pnpm test and lint the project with pnpm lint

while attributes are case insensitive, properties are not. to not introduce a breaking change, the lowercased variant is checked first.
fixes #9325
@changeset-bot
Copy link

changeset-bot bot commented Oct 18, 2023

🦋 Changeset detected

Latest commit: 8a9fcab

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
svelte Patch

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

@dummdidumm dummdidumm merged commit 9900c85 into master Oct 18, 2023
7 checks passed
@dummdidumm dummdidumm deleted the ce-camel-case branch October 18, 2023 13:46
@github-actions github-actions bot mentioned this pull request Oct 18, 2023
@@ -480,7 +480,10 @@ export function set_custom_element_data_map(node, data_map) {
/**
* @returns {void} */
export function set_custom_element_data(node, prop, value) {
if (prop in node) {
const lower = prop.toLowerCase(); // for backwards compatibility with existing behavior we do lowercase first
if (lower in node) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this is a particularly good thing to do. Can you remove this in Svelte 5?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, we'll likely do that

kelvinsjk pushed a commit to kelvinsjk/svelte that referenced this pull request Oct 19, 2023
while attributes are case insensitive, properties are not. to not introduce a breaking change, the lowercased variant is checked first.
fixes sveltejs#9325
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.

Cannot pass data into web component properties that use camel casing
3 participants