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

test(engine-server): lowercase attribute names #4706

Merged
merged 4 commits into from
Oct 28, 2024

Conversation

ekashida
Copy link
Member

Addresses a deviation in behavior for SSR.

@ekashida ekashida requested a review from a team as a code owner October 25, 2024 20:15
@ekashida ekashida changed the title test: ssr-specific test due to lowercased attribute names test(ssr-compiler): specific fixture for lowercased attribute names Oct 25, 2024
@ekashida ekashida enabled auto-merge (squash) October 25, 2024 20:16
@nolanlawson
Copy link
Collaborator

I think we should instead try to make engine-server emit attributes as lowercase when in the HTML namespace. I.e. fix this:

<x-cmp ARIA-LABEL="haha" DATA-FOO="bar" data-lwc-host-mutated="aria-label data-bar data-foo">

HTML is case-insensitive, so either way is fine. But under the hood, we need to think about deduping anyway:

connectedCallback() {
  this.setAttribute('FOO-BAR', 'a')
  this.removeAttribute('foo-bar') // should remove the attribute
}

So to solve this, we may as well lowercase the attribute when this.setAttribute is called.

For the SVG/MathML namespace we actually do have to care about case-sensitivity (e.g. SVG viewBox) so preserving the case is something we're going to have to tackle elsewhere. But it doesn't apply to the this.*Attribute case since LWC component hosts are only in the HTML namespace.

@ekashida ekashida changed the title test(ssr-compiler): specific fixture for lowercased attribute names test(engine-server): lowercase attribute names Oct 28, 2024
@ekashida
Copy link
Member Author

Fixed the behavior in engine-server since we expect it to coexist with ssr-compiler a while before deprecation.

Copy link
Collaborator

@nolanlawson nolanlawson left a comment

Choose a reason for hiding this comment

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

LGTM!

@ekashida ekashida merged commit a8e6ce6 into master Oct 28, 2024
11 checks passed
@ekashida ekashida deleted the ekashida/ssr-compiler-test branch October 28, 2024 20:53
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.

2 participants